177 lines
7.2 KiB
SQL
177 lines
7.2 KiB
SQL
-- --------------------------------------------------------
|
|
-- Host: 192.168.10.121
|
|
-- Server version: 10.11.11-MariaDB-0+deb12u1 - Debian 12
|
|
-- Server OS: debian-linux-gnu
|
|
-- HeidiSQL Version: 12.10.0.7000
|
|
-- --------------------------------------------------------
|
|
|
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
/*!40101 SET NAMES utf8 */;
|
|
/*!50503 SET NAMES utf8mb4 */;
|
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
|
|
|
-- Dumping structure for table bl_db.clients
|
|
CREATE TABLE IF NOT EXISTS `clients` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`first_name` varchar(100) NOT NULL,
|
|
`last_name` varchar(100) NOT NULL,
|
|
`company_name` varchar(150) DEFAULT NULL,
|
|
`vat_number` varchar(150) DEFAULT NULL,
|
|
`email` varchar(150) NOT NULL,
|
|
`password` varchar(255) NOT NULL,
|
|
`address1` varchar(255) DEFAULT NULL,
|
|
`address2` varchar(255) DEFAULT NULL,
|
|
`city` varchar(100) DEFAULT NULL,
|
|
`state` varchar(100) DEFAULT NULL,
|
|
`postcode` varchar(20) DEFAULT NULL,
|
|
`country` varchar(2) DEFAULT NULL,
|
|
`phone` varchar(50) DEFAULT NULL,
|
|
`payment_method` varchar(50) DEFAULT NULL,
|
|
`billing_contact` varchar(100) DEFAULT NULL,
|
|
`currency` varchar(10) DEFAULT 'USD',
|
|
`language` varchar(10) DEFAULT 'default',
|
|
`status` enum('active','inactive') DEFAULT 'active',
|
|
`client_group` varchar(50) DEFAULT 'none',
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
`admin_notes` text DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `email` (`email`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- Data exporting was unselected.
|
|
|
|
-- Dumping structure for table bl_db.email_logs
|
|
CREATE TABLE IF NOT EXISTS `email_logs` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`client_id` int(11) NOT NULL,
|
|
`subject` varchar(255) DEFAULT NULL,
|
|
`message` text DEFAULT NULL,
|
|
`sent_at` datetime DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `client_id` (`client_id`),
|
|
CONSTRAINT `email_logs_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- Data exporting was unselected.
|
|
|
|
-- Dumping structure for table bl_db.email_templates
|
|
CREATE TABLE IF NOT EXISTS `email_templates` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(100) NOT NULL,
|
|
`subject` varchar(255) NOT NULL,
|
|
`body` text NOT NULL,
|
|
`created_at` datetime DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- Data exporting was unselected.
|
|
|
|
-- Dumping structure for table bl_db.invoices
|
|
CREATE TABLE IF NOT EXISTS `invoices` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`invoice_number` varchar(100) DEFAULT NULL,
|
|
`client_id` int(11) NOT NULL,
|
|
`description` text DEFAULT NULL,
|
|
`payment_method` varchar(100) DEFAULT NULL,
|
|
`status` enum('დრაფტი','გადაუხდელი','გადასახდელი','გადახდილი','გაუქმებული') NOT NULL DEFAULT 'დრაფტი',
|
|
`total_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
|
|
`is_recurring` tinyint(1) DEFAULT 0,
|
|
`issue_date` date NOT NULL,
|
|
`due_date` date NOT NULL,
|
|
`payment_date` date DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
`recurring` tinyint(1) NOT NULL DEFAULT 0,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `invoice_number` (`invoice_number`),
|
|
KEY `client_id` (`client_id`),
|
|
CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- Data exporting was unselected.
|
|
|
|
-- Dumping structure for table bl_db.invoice_items
|
|
CREATE TABLE IF NOT EXISTS `invoice_items` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`invoice_id` int(11) NOT NULL,
|
|
`product_id` int(11) DEFAULT NULL,
|
|
`description` text DEFAULT NULL,
|
|
`amount` decimal(10,2) NOT NULL DEFAULT 0.00,
|
|
PRIMARY KEY (`id`),
|
|
KEY `invoice_id` (`invoice_id`),
|
|
CONSTRAINT `invoice_items_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- Data exporting was unselected.
|
|
|
|
-- Dumping structure for table bl_db.migration_log
|
|
CREATE TABLE IF NOT EXISTS `migration_log` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`filename` varchar(255) DEFAULT NULL,
|
|
`executed_at` datetime DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- Data exporting was unselected.
|
|
|
|
-- Dumping structure for table bl_db.products
|
|
CREATE TABLE IF NOT EXISTS `products` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(255) NOT NULL,
|
|
`group` varchar(255) NOT NULL,
|
|
`type` varchar(100) DEFAULT NULL,
|
|
`pay_type` varchar(100) DEFAULT NULL,
|
|
`auto_setup` varchar(100) DEFAULT NULL,
|
|
`url` text DEFAULT NULL,
|
|
`module` varchar(100) DEFAULT NULL,
|
|
`hidden` tinyint(1) DEFAULT 0,
|
|
`created_at` datetime DEFAULT current_timestamp(),
|
|
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
|
`price` decimal(10,2) NOT NULL DEFAULT 0.00,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- Data exporting was unselected.
|
|
|
|
-- Dumping structure for table bl_db.transactions
|
|
CREATE TABLE IF NOT EXISTS `transactions` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`invoice_id` int(11) NOT NULL,
|
|
`client_id` int(11) NOT NULL,
|
|
`amount` decimal(10,2) NOT NULL,
|
|
`method` varchar(100) DEFAULT NULL,
|
|
`status` enum('success','failed','pending') NOT NULL DEFAULT 'pending',
|
|
`notes` text DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `invoice_id` (`invoice_id`),
|
|
KEY `client_id` (`client_id`),
|
|
CONSTRAINT `transactions_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE,
|
|
CONSTRAINT `transactions_ibfk_2` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- Data exporting was unselected.
|
|
|
|
-- Dumping structure for table bl_db.users
|
|
CREATE TABLE IF NOT EXISTS `users` (
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
`first_name` varchar(100) NOT NULL,
|
|
`last_name` varchar(100) NOT NULL,
|
|
`email` varchar(150) NOT NULL,
|
|
`password` varchar(255) NOT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `email` (`email`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
-- Data exporting was unselected.
|
|
|
|
/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
|
|
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
|
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
|
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
|
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
|