1121 lines
43 KiB
SQL
1121 lines
43 KiB
SQL
/*M!999999\- enable the sandbox mode */
|
|
-- MariaDB dump 10.19 Distrib 10.11.14-MariaDB, for debian-linux-gnu (x86_64)
|
|
--
|
|
-- Host: 127.0.0.1 Database: app_38682
|
|
-- ------------------------------------------------------
|
|
-- Server version 10.11.14-MariaDB-0+deb12u2
|
|
|
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
/*!40101 SET NAMES utf8mb4 */;
|
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
|
/*!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 */;
|
|
|
|
--
|
|
-- Table structure for table `ads_images`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `ads_images`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `ads_images` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`image_path` varchar(255) NOT NULL,
|
|
`title` varchar(255) DEFAULT NULL,
|
|
`sort_order` int(11) DEFAULT 0,
|
|
`is_active` tinyint(1) DEFAULT 1,
|
|
`display_layout` enum('both','split','fullscreen') DEFAULT 'both',
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `ads_images`
|
|
--
|
|
|
|
LOCK TABLES `ads_images` WRITE;
|
|
/*!40000 ALTER TABLE `ads_images` DISABLE KEYS */;
|
|
INSERT INTO `ads_images` VALUES
|
|
(1,'assets/images/ads/ad_699bf2574849b.jpeg','Summer Special',0,1,'both','2026-02-23 19:48:29'),
|
|
(2,'assets/images/ads/ad_699bf270e9a69.jpeg','New Burger Launch',0,1,'both','2026-02-23 19:48:29');
|
|
/*!40000 ALTER TABLE `ads_images` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `areas`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `areas`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `areas` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`outlet_id` int(11) DEFAULT NULL,
|
|
`name` varchar(255) NOT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `outlet_id` (`outlet_id`),
|
|
CONSTRAINT `areas_ibfk_1` FOREIGN KEY (`outlet_id`) REFERENCES `outlets` (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `areas`
|
|
--
|
|
|
|
LOCK TABLES `areas` WRITE;
|
|
/*!40000 ALTER TABLE `areas` DISABLE KEYS */;
|
|
INSERT INTO `areas` VALUES
|
|
(1,1,'Main Dining Area','2026-02-23 19:48:28'),
|
|
(2,1,'Patio','2026-02-23 19:48:28'),
|
|
(3,2,'Indoor Section','2026-02-23 19:48:28');
|
|
/*!40000 ALTER TABLE `areas` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `attendance_logs`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `attendance_logs`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `attendance_logs` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`user_id` int(11) DEFAULT NULL,
|
|
`employee_id` varchar(50) DEFAULT NULL,
|
|
`log_timestamp` datetime DEFAULT NULL,
|
|
`log_type` enum('IN','OUT','OTHER') DEFAULT 'IN',
|
|
`device_id` varchar(100) DEFAULT NULL,
|
|
`ip_address` varchar(45) DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `user_id` (`user_id`),
|
|
CONSTRAINT `attendance_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `attendance_logs`
|
|
--
|
|
|
|
LOCK TABLES `attendance_logs` WRITE;
|
|
/*!40000 ALTER TABLE `attendance_logs` DISABLE KEYS */;
|
|
/*!40000 ALTER TABLE `attendance_logs` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `categories`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `categories`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `categories` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(255) NOT NULL,
|
|
`sort_order` int(11) DEFAULT 0,
|
|
`image_url` varchar(255) DEFAULT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `categories`
|
|
--
|
|
|
|
LOCK TABLES `categories` WRITE;
|
|
/*!40000 ALTER TABLE `categories` DISABLE KEYS */;
|
|
INSERT INTO `categories` VALUES
|
|
(1,'Burgers',1,NULL),
|
|
(2,'Sides',2,NULL),
|
|
(3,'Drinks',3,NULL),
|
|
(4,'Desserts',4,NULL),
|
|
(5,'Salads',5,NULL),
|
|
(6,'Pasta',6,NULL);
|
|
/*!40000 ALTER TABLE `categories` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `company_settings`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `company_settings`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `company_settings` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`company_name` varchar(255) NOT NULL DEFAULT 'My Restaurant',
|
|
`address` text DEFAULT NULL,
|
|
`phone` varchar(50) DEFAULT NULL,
|
|
`email` varchar(255) DEFAULT NULL,
|
|
`vat_rate` decimal(5,2) DEFAULT 0.00,
|
|
`currency_symbol` varchar(10) DEFAULT '$',
|
|
`currency_decimals` int(11) DEFAULT 2,
|
|
`logo_url` varchar(255) DEFAULT NULL,
|
|
`favicon_url` varchar(255) DEFAULT NULL,
|
|
`ctr_number` varchar(50) DEFAULT NULL,
|
|
`vat_number` varchar(50) DEFAULT NULL,
|
|
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
|
`auto_backup_enabled` tinyint(1) DEFAULT 0,
|
|
`last_auto_backup` timestamp NULL DEFAULT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `company_settings`
|
|
--
|
|
|
|
LOCK TABLES `company_settings` WRITE;
|
|
/*!40000 ALTER TABLE `company_settings` DISABLE KEYS */;
|
|
INSERT INTO `company_settings` VALUES
|
|
(1,'Al-Bidar Cafe','al -hamra','99359472','aalabry@gmail.com',5.00,'OMRR',3,'assets/images/company/logo_699d0d4e79490.png','assets/images/company/favicon_699d0d4e7a2f6.png','','OM99888','2026-02-24 05:08:06',1,NULL);
|
|
/*!40000 ALTER TABLE `company_settings` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `customers`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `customers`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `customers` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(255) NOT NULL,
|
|
`phone` varchar(20) DEFAULT NULL,
|
|
`email` varchar(255) DEFAULT NULL,
|
|
`points` int(11) DEFAULT 0,
|
|
`loyalty_redemptions_count` int(11) DEFAULT 0,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
`address` text DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `phone` (`phone`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `customers`
|
|
--
|
|
|
|
LOCK TABLES `customers` WRITE;
|
|
/*!40000 ALTER TABLE `customers` DISABLE KEYS */;
|
|
INSERT INTO `customers` VALUES
|
|
(1,'John Doe','5551234','john@example.com',50,0,'2026-02-23 19:48:28',NULL),
|
|
(2,'Jane Smith','5555678','jane@example.com',120,0,'2026-02-23 19:48:28',NULL),
|
|
(3,'Michael Brown','5558765','michael@example.com',15,0,'2026-02-23 19:48:28',NULL),
|
|
(4,'Emily Davis','5554321','emily@example.com',85,0,'2026-02-23 19:48:28',NULL),
|
|
(5,'Chris Wilson','5551111','chris@example.com',0,0,'2026-02-23 19:48:28',NULL),
|
|
(6,'Sarah Miller','5552222','sarah@example.com',200,0,'2026-02-23 19:48:28',NULL),
|
|
(7,'David Taylor','5553333','david@example.com',30,0,'2026-02-23 19:48:28',NULL),
|
|
(8,'moosa','99359472','laura@example.com',55,0,'2026-02-23 19:48:28','');
|
|
/*!40000 ALTER TABLE `customers` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `expense_categories`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `expense_categories`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `expense_categories` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(255) NOT NULL,
|
|
`description` text DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `expense_categories`
|
|
--
|
|
|
|
LOCK TABLES `expense_categories` WRITE;
|
|
/*!40000 ALTER TABLE `expense_categories` DISABLE KEYS */;
|
|
INSERT INTO `expense_categories` VALUES
|
|
(1,'Utilities','Electricity, Water, Gas','2026-02-23 19:48:29'),
|
|
(2,'Rent','Monthly outlet rent','2026-02-23 19:48:29'),
|
|
(3,'Supplies','Cleaning and office supplies','2026-02-23 19:48:29'),
|
|
(4,'Marketing','Advertisements and promotions','2026-02-23 19:48:29');
|
|
/*!40000 ALTER TABLE `expense_categories` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `expenses`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `expenses`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `expenses` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`category_id` int(11) NOT NULL,
|
|
`outlet_id` int(11) NOT NULL,
|
|
`amount` decimal(10,2) NOT NULL,
|
|
`description` text DEFAULT NULL,
|
|
`expense_date` date NOT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `category_id` (`category_id`),
|
|
KEY `outlet_id` (`outlet_id`),
|
|
CONSTRAINT `expenses_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `expense_categories` (`id`),
|
|
CONSTRAINT `expenses_ibfk_2` FOREIGN KEY (`outlet_id`) REFERENCES `outlets` (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `expenses`
|
|
--
|
|
|
|
LOCK TABLES `expenses` WRITE;
|
|
/*!40000 ALTER TABLE `expenses` DISABLE KEYS */;
|
|
INSERT INTO `expenses` VALUES
|
|
(1,3,2,194.31,'Sample expense for 2026-02-20','2026-02-20','2026-02-23 19:48:29'),
|
|
(2,3,4,467.60,'Sample expense for 2026-01-28','2026-01-28','2026-02-23 19:48:29'),
|
|
(3,3,2,470.68,'Sample expense for 2026-02-18','2026-02-18','2026-02-23 19:48:29'),
|
|
(4,4,1,377.27,'Sample expense for 2026-02-14','2026-02-14','2026-02-23 19:48:29'),
|
|
(5,2,3,92.16,'Sample expense for 2026-02-08','2026-02-08','2026-02-23 19:48:29'),
|
|
(6,3,3,250.49,'Sample expense for 2026-02-02','2026-02-02','2026-02-23 19:48:29'),
|
|
(7,3,4,423.19,'Sample expense for 2026-02-13','2026-02-13','2026-02-23 19:48:29'),
|
|
(8,3,3,247.94,'Sample expense for 2026-02-15','2026-02-15','2026-02-23 19:48:29'),
|
|
(9,1,2,244.02,'Sample expense for 2026-01-30','2026-01-30','2026-02-23 19:48:29'),
|
|
(10,4,3,228.07,'Sample expense for 2026-02-21','2026-02-21','2026-02-23 19:48:29'),
|
|
(11,1,3,398.84,'Sample expense for 2026-02-13','2026-02-13','2026-02-23 19:48:29'),
|
|
(12,1,3,450.92,'Sample expense for 2026-02-20','2026-02-20','2026-02-23 19:48:29'),
|
|
(13,1,2,379.73,'Sample expense for 2026-02-05','2026-02-05','2026-02-23 19:48:29'),
|
|
(14,2,2,440.60,'Sample expense for 2026-01-29','2026-01-29','2026-02-23 19:48:29'),
|
|
(15,3,2,185.03,'Sample expense for 2026-01-27','2026-01-27','2026-02-23 19:48:29');
|
|
/*!40000 ALTER TABLE `expenses` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `integration_settings`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `integration_settings`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `integration_settings` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`provider` varchar(50) NOT NULL,
|
|
`setting_key` varchar(100) NOT NULL,
|
|
`setting_value` text DEFAULT NULL,
|
|
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `unique_provider_key` (`provider`,`setting_key`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `integration_settings`
|
|
--
|
|
|
|
LOCK TABLES `integration_settings` WRITE;
|
|
/*!40000 ALTER TABLE `integration_settings` DISABLE KEYS */;
|
|
INSERT INTO `integration_settings` VALUES
|
|
(1,'wablas','domain','https://deu.wablas.com/','2026-02-24 02:31:26'),
|
|
(2,'wablas','token','xOSMYzXiM9uABP0zcoALzlGJjKsRBaLCS2paBAE2kyECNNJkCQbgMW8','2026-02-24 02:31:26'),
|
|
(3,'wablas','secret_key','ZBtnBwfm','2026-02-24 02:31:26'),
|
|
(4,'wablas','order_template','Dear *{customer_name}*,\r\n\r\nThank you for dining with *{company_name}*! 🍽️\r\n\r\n*Order Details:*\r\n{order_details}\r\n\r\nTotal: *{total_amount}* OMR\r\n\r\nYou\'ve earned *{points_earned} points* with this order.\r\n💰 *Current Balance: {new_balance} points*','2026-02-24 02:31:26'),
|
|
(5,'wablas','is_enabled','0','2026-02-24 02:31:26');
|
|
/*!40000 ALTER TABLE `integration_settings` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `loyalty_settings`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `loyalty_settings`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `loyalty_settings` (
|
|
`id` int(11) NOT NULL,
|
|
`points_per_order` int(11) DEFAULT 10,
|
|
`points_for_free_meal` int(11) DEFAULT 70,
|
|
`is_enabled` tinyint(1) DEFAULT 1,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `loyalty_settings`
|
|
--
|
|
|
|
LOCK TABLES `loyalty_settings` WRITE;
|
|
/*!40000 ALTER TABLE `loyalty_settings` DISABLE KEYS */;
|
|
INSERT INTO `loyalty_settings` VALUES
|
|
(1,10,70,1);
|
|
/*!40000 ALTER TABLE `loyalty_settings` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `migrations`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `migrations`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `migrations` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`migration_name` varchar(255) NOT NULL,
|
|
`applied_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `migration_name` (`migration_name`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `migrations`
|
|
--
|
|
|
|
LOCK TABLES `migrations` WRITE;
|
|
/*!40000 ALTER TABLE `migrations` DISABLE KEYS */;
|
|
INSERT INTO `migrations` VALUES
|
|
(1,'001_add_payments.sql','2026-02-23 19:40:07'),
|
|
(2,'003_add_payment_type_to_orders.sql','2026-02-23 19:40:07'),
|
|
(3,'004_seed_payment_types.sql','2026-02-23 19:40:07'),
|
|
(4,'006_integration_settings.sql','2026-02-23 19:40:07'),
|
|
(5,'007_add_loyalty_payment_type.sql','2026-02-23 19:40:07'),
|
|
(6,'008_user_system.sql','2026-02-23 19:40:07'),
|
|
(7,'009_user_outlets.sql','2026-02-23 19:40:07'),
|
|
(8,'010_ads_images.sql','2026-02-23 19:40:07'),
|
|
(9,'011_add_user_id_to_orders.sql','2026-02-23 19:40:07'),
|
|
(10,'012_expenses_schema.sql','2026-02-23 19:40:07'),
|
|
(11,'013_product_promotions.sql','2026-02-23 19:40:07'),
|
|
(12,'015_add_redemptions_to_customers.sql','2026-02-23 19:40:07'),
|
|
(13,'016_add_profile_pic_to_users.sql','2026-02-23 19:40:07'),
|
|
(14,'017_attendance_system.sql','2026-02-23 19:40:07'),
|
|
(15,'018_add_cost_price_to_products.sql','2026-02-23 19:40:07'),
|
|
(16,'019_purchase_module.sql','2026-02-23 19:40:07'),
|
|
(17,'020_staff_ratings.sql','2026-02-23 19:40:07'),
|
|
(18,'021_add_is_ratable_to_users.sql','2026-02-23 19:40:07'),
|
|
(19,'022_service_ratings.sql','2026-02-23 19:40:07'),
|
|
(20,'002_add_customer_id_to_orders.sql','2026-02-23 19:40:26'),
|
|
(21,'005_loyalty_schema.sql','2026-02-23 19:40:26'),
|
|
(22,'014_loyalty_toggle.sql','2026-02-23 19:40:26'),
|
|
(23,'023_add_image_url_to_categories.sql','2026-02-23 19:40:26');
|
|
/*!40000 ALTER TABLE `migrations` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `order_items`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `order_items`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `order_items` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`order_id` int(11) DEFAULT NULL,
|
|
`product_id` int(11) DEFAULT NULL,
|
|
`variant_id` int(11) DEFAULT NULL,
|
|
`quantity` int(11) NOT NULL,
|
|
`unit_price` decimal(10,2) NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `order_id` (`order_id`),
|
|
KEY `product_id` (`product_id`),
|
|
CONSTRAINT `order_items_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`),
|
|
CONSTRAINT `order_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=126 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `order_items`
|
|
--
|
|
|
|
LOCK TABLES `order_items` WRITE;
|
|
/*!40000 ALTER TABLE `order_items` DISABLE KEYS */;
|
|
INSERT INTO `order_items` VALUES
|
|
(1,1,4,NULL,2,3.50),
|
|
(2,2,12,NULL,2,13.99),
|
|
(3,3,3,NULL,1,5.99),
|
|
(4,4,2,NULL,3,11.50),
|
|
(5,4,3,NULL,3,5.99),
|
|
(6,5,13,NULL,2,12.50),
|
|
(7,5,9,NULL,3,6.99),
|
|
(8,5,8,NULL,3,7.99),
|
|
(9,6,9,NULL,1,6.99),
|
|
(10,7,13,NULL,2,12.50),
|
|
(11,8,9,NULL,1,6.99),
|
|
(12,8,10,NULL,3,9.50),
|
|
(13,8,4,NULL,2,3.50),
|
|
(14,8,3,NULL,3,5.99),
|
|
(15,9,10,NULL,3,9.50),
|
|
(16,10,5,NULL,2,15.99),
|
|
(17,10,1,NULL,3,12.99),
|
|
(18,11,3,NULL,2,5.99),
|
|
(19,11,1,NULL,3,12.99),
|
|
(20,11,6,NULL,3,6.50),
|
|
(21,11,11,NULL,3,10.50),
|
|
(22,12,8,NULL,3,7.99),
|
|
(23,12,4,NULL,3,3.50),
|
|
(24,12,5,NULL,3,15.99),
|
|
(25,13,9,NULL,1,6.99),
|
|
(26,13,8,NULL,2,7.99),
|
|
(27,13,2,NULL,3,11.50),
|
|
(28,13,1,NULL,3,12.99),
|
|
(29,14,2,NULL,2,11.50),
|
|
(30,14,10,NULL,3,9.50),
|
|
(31,14,8,NULL,1,7.99),
|
|
(32,15,12,NULL,1,13.99),
|
|
(33,15,9,NULL,3,6.99),
|
|
(34,15,6,NULL,3,6.50),
|
|
(35,15,10,NULL,2,9.50),
|
|
(36,16,8,NULL,3,7.99),
|
|
(37,17,12,NULL,2,13.99),
|
|
(38,17,6,NULL,2,6.50),
|
|
(39,17,13,NULL,1,12.50),
|
|
(40,18,1,NULL,1,12.99),
|
|
(41,18,5,NULL,3,15.99),
|
|
(42,18,10,NULL,1,9.50),
|
|
(43,18,8,NULL,3,7.99),
|
|
(44,19,2,NULL,1,11.50),
|
|
(45,20,9,NULL,1,6.99),
|
|
(46,21,3,NULL,3,5.99),
|
|
(47,21,1,NULL,3,12.99),
|
|
(48,22,9,NULL,3,6.99),
|
|
(49,22,1,NULL,3,12.99),
|
|
(50,22,11,NULL,3,10.50),
|
|
(51,22,5,NULL,2,15.99),
|
|
(52,23,13,NULL,2,12.50),
|
|
(53,23,11,NULL,3,10.50),
|
|
(54,23,8,NULL,3,7.99),
|
|
(55,23,6,NULL,3,6.50),
|
|
(56,24,6,NULL,3,6.50),
|
|
(57,24,13,NULL,2,12.50),
|
|
(58,25,1,NULL,3,12.99),
|
|
(59,25,5,NULL,3,15.99),
|
|
(60,25,8,NULL,3,7.99),
|
|
(61,25,2,NULL,1,11.50),
|
|
(62,26,9,NULL,1,6.99),
|
|
(63,26,10,NULL,1,9.50),
|
|
(64,27,9,NULL,2,6.99),
|
|
(65,27,4,NULL,1,3.50),
|
|
(66,28,8,NULL,2,7.99),
|
|
(67,28,10,NULL,3,9.50),
|
|
(68,28,5,NULL,1,15.99),
|
|
(69,29,7,NULL,2,3.99),
|
|
(70,29,9,NULL,1,6.99),
|
|
(71,29,6,NULL,2,6.50),
|
|
(72,30,9,NULL,2,6.99),
|
|
(73,30,10,NULL,2,9.50),
|
|
(74,30,12,NULL,3,13.99),
|
|
(75,31,8,NULL,1,7.99),
|
|
(76,31,1,NULL,3,12.99),
|
|
(77,31,13,NULL,2,12.50),
|
|
(78,32,1,NULL,2,12.99),
|
|
(79,32,3,NULL,3,5.99),
|
|
(80,33,5,NULL,3,15.99),
|
|
(81,34,11,NULL,2,10.50),
|
|
(82,34,5,NULL,1,15.99),
|
|
(83,34,10,NULL,1,9.50),
|
|
(84,35,2,NULL,3,11.50),
|
|
(85,35,7,NULL,1,3.99),
|
|
(86,36,1,NULL,2,12.99),
|
|
(87,36,11,NULL,2,10.50),
|
|
(88,36,13,NULL,2,12.50),
|
|
(89,36,6,NULL,3,6.50),
|
|
(90,37,5,NULL,3,15.99),
|
|
(91,37,2,NULL,2,11.50),
|
|
(92,37,8,NULL,3,7.99),
|
|
(93,38,4,NULL,3,3.50),
|
|
(94,38,10,NULL,2,9.50),
|
|
(95,38,2,NULL,3,11.50),
|
|
(96,38,3,NULL,1,5.99),
|
|
(97,39,5,NULL,2,15.99),
|
|
(98,40,8,NULL,3,7.99),
|
|
(99,41,4,NULL,1,3.50),
|
|
(100,41,6,NULL,1,6.50),
|
|
(101,42,12,NULL,2,13.99),
|
|
(102,43,3,NULL,1,5.99),
|
|
(103,43,11,NULL,2,10.50),
|
|
(104,43,6,NULL,3,6.50),
|
|
(105,43,8,NULL,3,7.99),
|
|
(106,44,13,NULL,1,12.50),
|
|
(107,45,8,NULL,3,7.99),
|
|
(108,46,11,NULL,3,10.50),
|
|
(109,46,13,NULL,3,12.50),
|
|
(110,47,13,NULL,1,12.50),
|
|
(111,48,6,NULL,1,6.50),
|
|
(112,49,2,NULL,2,11.50),
|
|
(113,50,3,NULL,3,5.99),
|
|
(114,50,6,NULL,1,6.50),
|
|
(115,51,6,NULL,1,6.50),
|
|
(116,51,3,NULL,1,5.99),
|
|
(117,51,5,NULL,1,15.99),
|
|
(118,52,3,NULL,1,5.99),
|
|
(119,52,5,NULL,1,15.99),
|
|
(120,52,9,NULL,1,6.99),
|
|
(121,53,9,NULL,1,6.99),
|
|
(122,53,8,NULL,1,7.99),
|
|
(123,54,1,NULL,1,12.99),
|
|
(124,55,5,NULL,1,15.99),
|
|
(125,55,1,NULL,1,12.99);
|
|
/*!40000 ALTER TABLE `order_items` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `orders`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `orders`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `orders` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`outlet_id` int(11) DEFAULT NULL,
|
|
`user_id` int(11) DEFAULT NULL,
|
|
`customer_id` int(11) DEFAULT NULL,
|
|
`table_id` int(11) DEFAULT NULL,
|
|
`table_number` varchar(50) DEFAULT NULL,
|
|
`order_type` enum('dine-in','delivery','drive-thru','takeaway') DEFAULT 'dine-in',
|
|
`status` enum('pending','preparing','ready','completed','cancelled') DEFAULT 'pending',
|
|
`payment_type_id` int(11) DEFAULT NULL,
|
|
`total_amount` decimal(10,2) NOT NULL,
|
|
`discount` decimal(10,2) DEFAULT 0.00,
|
|
`customer_name` varchar(255) DEFAULT NULL,
|
|
`customer_phone` varchar(50) DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `outlet_id` (`outlet_id`),
|
|
KEY `user_id` (`user_id`),
|
|
KEY `table_id` (`table_id`),
|
|
KEY `fk_orders_customer` (`customer_id`),
|
|
CONSTRAINT `fk_orders_customer` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
|
|
CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`outlet_id`) REFERENCES `outlets` (`id`),
|
|
CONSTRAINT `orders_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
|
|
CONSTRAINT `orders_ibfk_3` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
|
|
CONSTRAINT `orders_ibfk_4` FOREIGN KEY (`table_id`) REFERENCES `tables` (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `orders`
|
|
--
|
|
|
|
LOCK TABLES `orders` WRITE;
|
|
/*!40000 ALTER TABLE `orders` DISABLE KEYS */;
|
|
INSERT INTO `orders` VALUES
|
|
(1,1,2,4,3,NULL,'takeaway','completed',1,7.00,0.00,NULL,NULL,'2026-02-17 12:56:39'),
|
|
(2,2,3,NULL,3,NULL,'takeaway','cancelled',NULL,27.98,0.00,NULL,NULL,'2026-02-15 11:27:36'),
|
|
(3,4,1,NULL,NULL,NULL,'delivery','preparing',NULL,5.99,0.00,NULL,NULL,'2026-01-26 21:23:42'),
|
|
(4,1,2,7,1,NULL,'delivery','completed',NULL,52.47,0.00,NULL,NULL,'2026-01-29 12:30:10'),
|
|
(5,1,2,NULL,4,NULL,'takeaway','completed',2,69.94,0.00,NULL,NULL,'2026-02-09 21:53:42'),
|
|
(6,1,1,5,5,NULL,'delivery','completed',NULL,6.99,0.00,NULL,NULL,'2026-02-13 17:44:22'),
|
|
(7,1,1,NULL,5,NULL,'delivery','completed',2,25.00,0.00,NULL,NULL,'2026-02-10 18:30:26'),
|
|
(8,1,3,1,4,NULL,'takeaway','completed',1,60.46,0.00,NULL,NULL,'2026-01-27 12:58:30'),
|
|
(9,1,2,8,4,NULL,'takeaway','completed',1,28.50,0.00,NULL,NULL,'2026-01-31 17:43:40'),
|
|
(10,3,1,7,NULL,NULL,'dine-in','preparing',NULL,70.95,0.00,NULL,NULL,'2026-01-27 14:36:19'),
|
|
(11,2,2,NULL,4,NULL,'takeaway','completed',1,101.95,0.00,NULL,NULL,'2026-02-09 15:56:54'),
|
|
(12,4,2,NULL,NULL,NULL,'dine-in','pending',NULL,82.44,0.00,NULL,NULL,'2026-02-13 13:53:50'),
|
|
(13,4,1,4,NULL,NULL,'delivery','ready',NULL,96.44,0.00,NULL,NULL,'2026-02-23 19:27:40'),
|
|
(14,2,1,6,3,NULL,'dine-in','preparing',NULL,59.49,0.00,NULL,NULL,'2026-01-24 16:30:19'),
|
|
(15,1,1,7,4,NULL,'dine-in','completed',2,73.46,0.00,NULL,NULL,'2026-02-16 22:12:57'),
|
|
(16,4,3,6,NULL,NULL,'takeaway','completed',2,23.97,0.00,NULL,NULL,'2026-02-21 17:46:14'),
|
|
(17,2,2,2,4,NULL,'dine-in','cancelled',NULL,53.48,0.00,NULL,NULL,'2026-02-09 22:58:34'),
|
|
(18,2,3,NULL,3,NULL,'dine-in','ready',NULL,94.43,0.00,NULL,NULL,'2026-02-09 17:22:45'),
|
|
(19,2,1,6,3,NULL,'takeaway','completed',1,11.50,0.00,NULL,NULL,'2026-01-30 15:04:40'),
|
|
(20,1,3,1,7,NULL,'delivery','completed',NULL,6.99,0.00,NULL,NULL,'2026-02-21 22:58:03'),
|
|
(21,1,2,1,2,NULL,'delivery','completed',2,56.94,0.00,NULL,NULL,'2026-02-16 20:55:36'),
|
|
(22,1,3,NULL,7,NULL,'dine-in','completed',NULL,123.42,0.00,NULL,NULL,'2026-02-13 19:42:01'),
|
|
(23,3,2,1,NULL,NULL,'delivery','completed',1,99.97,0.00,NULL,NULL,'2026-02-18 19:01:06'),
|
|
(24,1,2,NULL,6,NULL,'dine-in','completed',NULL,44.50,0.00,NULL,NULL,'2026-02-04 21:44:38'),
|
|
(25,2,1,4,4,NULL,'takeaway','completed',2,122.41,0.00,NULL,NULL,'2026-02-16 21:35:44'),
|
|
(26,4,1,7,NULL,NULL,'delivery','cancelled',NULL,16.49,0.00,NULL,NULL,'2026-02-18 21:55:05'),
|
|
(27,2,3,6,2,NULL,'delivery','completed',2,17.48,0.00,NULL,NULL,'2026-01-29 21:14:52'),
|
|
(28,1,2,3,3,NULL,'takeaway','completed',NULL,60.47,0.00,NULL,NULL,'2026-02-12 18:52:11'),
|
|
(29,3,2,7,NULL,NULL,'delivery','preparing',NULL,27.97,0.00,NULL,NULL,'2026-02-02 15:06:49'),
|
|
(30,1,1,2,4,NULL,'delivery','completed',2,74.95,0.00,NULL,NULL,'2026-02-11 13:15:33'),
|
|
(31,2,2,3,2,NULL,'delivery','completed',2,71.96,0.00,NULL,NULL,'2026-02-05 15:04:26'),
|
|
(32,1,3,2,4,NULL,'takeaway','completed',NULL,43.95,0.00,NULL,NULL,'2026-02-11 21:21:43'),
|
|
(33,2,2,2,6,NULL,'delivery','cancelled',NULL,47.97,0.00,NULL,NULL,'2026-02-12 20:10:48'),
|
|
(34,3,3,NULL,NULL,NULL,'dine-in','completed',1,46.49,0.00,NULL,NULL,'2026-02-11 14:51:35'),
|
|
(35,3,3,5,NULL,NULL,'delivery','completed',1,38.49,0.00,NULL,NULL,'2026-02-20 17:08:32'),
|
|
(36,3,1,4,NULL,NULL,'delivery','completed',1,91.48,0.00,NULL,NULL,'2026-02-01 16:21:38'),
|
|
(37,3,1,NULL,NULL,NULL,'delivery','pending',NULL,94.94,0.00,NULL,NULL,'2026-02-08 18:31:06'),
|
|
(38,3,1,5,NULL,NULL,'dine-in','completed',1,69.99,0.00,NULL,NULL,'2026-02-04 13:01:09'),
|
|
(39,2,3,3,6,NULL,'delivery','preparing',NULL,31.98,0.00,NULL,NULL,'2026-02-16 13:13:22'),
|
|
(40,3,3,6,NULL,NULL,'takeaway','pending',NULL,23.97,0.00,NULL,NULL,'2026-02-01 17:33:38'),
|
|
(41,2,1,5,4,NULL,'takeaway','ready',NULL,10.00,0.00,NULL,NULL,'2026-01-31 14:49:13'),
|
|
(42,3,3,2,NULL,NULL,'delivery','completed',2,27.98,0.00,NULL,NULL,'2026-01-28 11:38:11'),
|
|
(43,2,2,8,3,NULL,'dine-in','pending',NULL,70.46,0.00,NULL,NULL,'2026-02-21 13:27:55'),
|
|
(44,4,1,2,NULL,NULL,'delivery','cancelled',NULL,12.50,0.00,NULL,NULL,'2026-02-18 12:47:10'),
|
|
(45,1,1,NULL,3,NULL,'delivery','completed',1,23.97,0.00,NULL,NULL,'2026-01-30 11:43:19'),
|
|
(46,3,2,2,NULL,NULL,'takeaway','cancelled',NULL,69.00,0.00,NULL,NULL,'2026-01-25 22:14:08'),
|
|
(47,4,1,NULL,NULL,NULL,'dine-in','completed',1,12.50,0.00,NULL,NULL,'2026-02-19 18:31:12'),
|
|
(48,4,2,NULL,NULL,NULL,'takeaway','completed',1,6.50,0.00,NULL,NULL,'2026-02-21 18:02:45'),
|
|
(49,2,1,NULL,7,NULL,'dine-in','pending',NULL,23.00,0.00,NULL,NULL,'2026-02-02 18:23:13'),
|
|
(50,3,3,NULL,NULL,NULL,'delivery','cancelled',NULL,24.47,0.00,NULL,NULL,'2026-01-28 12:13:05'),
|
|
(51,1,1,8,NULL,NULL,'takeaway','completed',1,28.48,0.00,'moosa','99359472','2026-02-24 02:28:17'),
|
|
(52,1,1,NULL,NULL,NULL,'takeaway','completed',1,28.97,0.00,NULL,NULL,'2026-02-24 02:39:42'),
|
|
(53,1,1,NULL,NULL,NULL,'takeaway','completed',1,14.98,0.00,NULL,NULL,'2026-02-24 02:40:36'),
|
|
(54,1,1,NULL,NULL,NULL,'takeaway','completed',1,12.99,0.00,NULL,NULL,'2026-02-24 02:48:59'),
|
|
(55,1,1,NULL,NULL,NULL,'takeaway','completed',1,28.98,0.00,NULL,NULL,'2026-02-24 02:49:23');
|
|
/*!40000 ALTER TABLE `orders` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `outlets`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `outlets`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `outlets` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(255) NOT NULL,
|
|
`address` text DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `outlets`
|
|
--
|
|
|
|
LOCK TABLES `outlets` WRITE;
|
|
/*!40000 ALTER TABLE `outlets` DISABLE KEYS */;
|
|
INSERT INTO `outlets` VALUES
|
|
(1,'Main Downtown','123 Main St','2026-02-23 18:56:57'),
|
|
(2,'Westside Hub','456 West Blvd','2026-02-23 18:56:57'),
|
|
(3,'North Point Mall','789 North Ave','2026-02-23 19:48:28'),
|
|
(4,'South Beach','321 Coastal Rd','2026-02-23 19:48:28');
|
|
/*!40000 ALTER TABLE `outlets` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `payment_types`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `payment_types`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `payment_types` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(255) NOT NULL,
|
|
`type` enum('cash','card','api') DEFAULT 'cash',
|
|
`api_provider` varchar(50) DEFAULT NULL,
|
|
`is_active` tinyint(1) DEFAULT 1,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `payment_types`
|
|
--
|
|
|
|
LOCK TABLES `payment_types` WRITE;
|
|
/*!40000 ALTER TABLE `payment_types` DISABLE KEYS */;
|
|
INSERT INTO `payment_types` VALUES
|
|
(1,'Cash','cash',NULL,1,'2026-02-23 19:40:07'),
|
|
(2,'Credit Card','card',NULL,1,'2026-02-23 19:40:07'),
|
|
(3,'Loyalty Redeem','cash',NULL,0,'2026-02-23 19:40:07');
|
|
/*!40000 ALTER TABLE `payment_types` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `product_variants`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `product_variants`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `product_variants` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`product_id` int(11) DEFAULT NULL,
|
|
`name` varchar(255) NOT NULL,
|
|
`price_adjustment` decimal(10,2) DEFAULT 0.00,
|
|
PRIMARY KEY (`id`),
|
|
KEY `product_id` (`product_id`),
|
|
CONSTRAINT `product_variants_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `product_variants`
|
|
--
|
|
|
|
LOCK TABLES `product_variants` WRITE;
|
|
/*!40000 ALTER TABLE `product_variants` DISABLE KEYS */;
|
|
/*!40000 ALTER TABLE `product_variants` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `products`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `products`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `products` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`category_id` int(11) DEFAULT NULL,
|
|
`name` varchar(255) NOT NULL,
|
|
`description` text DEFAULT NULL,
|
|
`price` decimal(10,2) NOT NULL,
|
|
`cost_price` decimal(10,2) DEFAULT 0.00,
|
|
`stock_quantity` int(11) DEFAULT 0,
|
|
`image_url` varchar(255) DEFAULT NULL,
|
|
`promo_discount_percent` decimal(5,2) DEFAULT NULL,
|
|
`promo_date_from` date DEFAULT NULL,
|
|
`promo_date_to` date DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `category_id` (`category_id`),
|
|
CONSTRAINT `products_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `products`
|
|
--
|
|
|
|
LOCK TABLES `products` WRITE;
|
|
/*!40000 ALTER TABLE `products` DISABLE KEYS */;
|
|
INSERT INTO `products` VALUES
|
|
(1,1,'Signature Burger','Juicy beef patty with special sauce',12.99,0.00,-2,NULL,NULL,NULL,NULL),
|
|
(2,1,'Veggie Delight','Plant-based patty with fresh avocado',11.50,0.00,0,NULL,NULL,NULL,NULL),
|
|
(3,2,'Truffle Fries','Crispy fries with truffle oil and parmesan',5.99,0.00,-2,NULL,NULL,NULL,NULL),
|
|
(4,3,'Craft Cola','House-made sparkling cola',3.50,0.00,0,NULL,NULL,NULL,NULL),
|
|
(5,1,'Double Bacon Burger','Double patty with crispy bacon and cheddar',15.99,6.50,97,NULL,NULL,NULL,NULL),
|
|
(6,2,'Sweet Potato Fries','Waffle cut sweet potato fries with maple dip',6.50,2.00,199,NULL,NULL,NULL,NULL),
|
|
(7,3,'Lemon Iced Tea','Freshly brewed black tea with lemon and honey',3.99,0.50,500,NULL,NULL,NULL,NULL),
|
|
(8,4,'Chocolate Lava Cake','Warm chocolate cake with a gooey center',7.99,3.00,49,NULL,NULL,NULL,NULL),
|
|
(9,4,'NY Cheesecake','Classic creamy cheesecake with strawberry topping',6.99,2.50,58,NULL,NULL,NULL,NULL),
|
|
(10,5,'Caesar Salad','Romaine lettuce with parmesan, croutons and dressing',9.50,3.50,80,NULL,NULL,NULL,NULL),
|
|
(11,5,'Greek Salad','Cucumber, tomato, onion, olives and feta cheese',10.50,4.00,70,NULL,NULL,NULL,NULL),
|
|
(12,6,'Spaghetti Carbonara','Pasta with eggs, cheese, guanciale and black pepper',13.99,5.50,90,NULL,NULL,NULL,NULL),
|
|
(13,6,'Penne Arrabbiata','Spicy pasta with tomato sauce, garlic and chili',12.50,4.50,100,NULL,NULL,NULL,NULL);
|
|
/*!40000 ALTER TABLE `products` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `purchase_items`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `purchase_items`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `purchase_items` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`purchase_id` int(11) NOT NULL,
|
|
`product_id` int(11) NOT NULL,
|
|
`quantity` int(11) NOT NULL,
|
|
`cost_price` decimal(10,2) NOT NULL,
|
|
`total_price` decimal(10,2) NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `purchase_id` (`purchase_id`),
|
|
KEY `product_id` (`product_id`),
|
|
CONSTRAINT `purchase_items_ibfk_1` FOREIGN KEY (`purchase_id`) REFERENCES `purchases` (`id`) ON DELETE CASCADE,
|
|
CONSTRAINT `purchase_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `purchase_items`
|
|
--
|
|
|
|
LOCK TABLES `purchase_items` WRITE;
|
|
/*!40000 ALTER TABLE `purchase_items` DISABLE KEYS */;
|
|
INSERT INTO `purchase_items` VALUES
|
|
(1,1,11,36,4.00,144.00),
|
|
(2,2,1,27,0.00,0.00),
|
|
(3,2,4,29,0.00,0.00),
|
|
(4,2,8,29,3.00,87.00),
|
|
(5,3,8,26,3.00,78.00),
|
|
(6,3,4,35,0.00,0.00),
|
|
(7,4,5,31,6.50,201.50),
|
|
(8,4,7,19,0.50,9.50),
|
|
(9,5,9,32,2.50,80.00),
|
|
(10,5,11,14,4.00,56.00);
|
|
/*!40000 ALTER TABLE `purchase_items` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `purchases`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `purchases`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `purchases` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`supplier_id` int(11) DEFAULT NULL,
|
|
`purchase_date` date NOT NULL,
|
|
`total_amount` decimal(10,2) DEFAULT 0.00,
|
|
`status` enum('pending','completed','cancelled') DEFAULT 'pending',
|
|
`notes` text DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `supplier_id` (`supplier_id`),
|
|
CONSTRAINT `purchases_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`) ON DELETE SET NULL
|
|
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `purchases`
|
|
--
|
|
|
|
LOCK TABLES `purchases` WRITE;
|
|
/*!40000 ALTER TABLE `purchases` DISABLE KEYS */;
|
|
INSERT INTO `purchases` VALUES
|
|
(1,3,'2026-02-11',144.00,'completed',NULL,'2026-02-23 19:48:29'),
|
|
(2,1,'2026-02-17',87.00,'completed',NULL,'2026-02-23 19:48:29'),
|
|
(3,1,'2026-02-15',78.00,'completed',NULL,'2026-02-23 19:48:29'),
|
|
(4,3,'2026-02-11',211.00,'completed',NULL,'2026-02-23 19:48:29'),
|
|
(5,2,'2026-02-09',136.00,'completed',NULL,'2026-02-23 19:48:29');
|
|
/*!40000 ALTER TABLE `purchases` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `service_ratings`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `service_ratings`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `service_ratings` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`rating` int(11) NOT NULL CHECK (`rating` >= 1 and `rating` <= 5),
|
|
`comment` text DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `service_ratings`
|
|
--
|
|
|
|
LOCK TABLES `service_ratings` WRITE;
|
|
/*!40000 ALTER TABLE `service_ratings` DISABLE KEYS */;
|
|
INSERT INTO `service_ratings` VALUES
|
|
(1,5,'Excellent service and great food!','2026-02-23 19:48:29'),
|
|
(2,4,'Burger was amazing, but wait time was a bit long.','2026-02-23 19:48:29'),
|
|
(3,5,'Best pizza in town!','2026-02-23 19:48:29'),
|
|
(4,3,'Okay, but nothing special.','2026-02-23 19:48:29');
|
|
/*!40000 ALTER TABLE `service_ratings` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `staff_ratings`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `staff_ratings`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `staff_ratings` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`user_id` int(11) NOT NULL,
|
|
`rating` int(11) NOT NULL CHECK (`rating` >= 1 and `rating` <= 5),
|
|
`comment` text DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `user_id` (`user_id`),
|
|
CONSTRAINT `staff_ratings_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `staff_ratings`
|
|
--
|
|
|
|
LOCK TABLES `staff_ratings` WRITE;
|
|
/*!40000 ALTER TABLE `staff_ratings` DISABLE KEYS */;
|
|
/*!40000 ALTER TABLE `staff_ratings` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `suppliers`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `suppliers`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `suppliers` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(255) NOT NULL,
|
|
`contact_person` varchar(255) DEFAULT NULL,
|
|
`email` varchar(255) DEFAULT NULL,
|
|
`phone` varchar(50) DEFAULT NULL,
|
|
`address` text DEFAULT NULL,
|
|
`vat_no` varchar(50) DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `suppliers`
|
|
--
|
|
|
|
LOCK TABLES `suppliers` WRITE;
|
|
/*!40000 ALTER TABLE `suppliers` DISABLE KEYS */;
|
|
INSERT INTO `suppliers` VALUES
|
|
(1,'Fresh Farms Ltd','Farmer Joe',NULL,'555-9999',NULL,NULL,'2026-02-23 19:48:29'),
|
|
(2,'Beverage Co','Drink Distributor',NULL,'555-8888',NULL,NULL,'2026-02-23 19:48:29'),
|
|
(3,'Kitchen Supplies Inc','Cookware Expert','','555-7777','','','2026-02-23 19:48:29');
|
|
/*!40000 ALTER TABLE `suppliers` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `tables`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `tables`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `tables` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`area_id` int(11) DEFAULT NULL,
|
|
`name` varchar(50) NOT NULL,
|
|
`capacity` int(11) DEFAULT 4,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `area_id` (`area_id`),
|
|
CONSTRAINT `tables_ibfk_1` FOREIGN KEY (`area_id`) REFERENCES `areas` (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `tables`
|
|
--
|
|
|
|
LOCK TABLES `tables` WRITE;
|
|
/*!40000 ALTER TABLE `tables` DISABLE KEYS */;
|
|
INSERT INTO `tables` VALUES
|
|
(1,1,'Table 1',4,'2026-02-23 19:48:28'),
|
|
(2,1,'Table 2',4,'2026-02-23 19:48:28'),
|
|
(3,1,'Table 3',6,'2026-02-23 19:48:28'),
|
|
(4,2,'Patio 1',2,'2026-02-23 19:48:28'),
|
|
(5,2,'Patio 2',2,'2026-02-23 19:48:28'),
|
|
(6,3,'Booth A',4,'2026-02-23 19:48:28'),
|
|
(7,3,'Booth B',4,'2026-02-23 19:48:28');
|
|
/*!40000 ALTER TABLE `tables` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `user_groups`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `user_groups`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `user_groups` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(255) NOT NULL,
|
|
`permissions` text DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `user_groups`
|
|
--
|
|
|
|
LOCK TABLES `user_groups` WRITE;
|
|
/*!40000 ALTER TABLE `user_groups` DISABLE KEYS */;
|
|
INSERT INTO `user_groups` VALUES
|
|
(1,'Administrator','all','2026-02-23 18:56:57'),
|
|
(2,'Administrator','all','2026-02-23 19:40:07'),
|
|
(3,'Manager','manage_orders,manage_products,manage_reports','2026-02-23 19:40:07'),
|
|
(4,'Cashier','pos_view,pos_add,pos_del,kitchen_view,kitchen_add,kitchen_del,products_view,categories_view','2026-02-23 19:40:07'),
|
|
(5,'Waiter','pos','2026-02-23 19:40:07');
|
|
/*!40000 ALTER TABLE `user_groups` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `user_outlets`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `user_outlets`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `user_outlets` (
|
|
`user_id` int(11) NOT NULL,
|
|
`outlet_id` int(11) NOT NULL,
|
|
PRIMARY KEY (`user_id`,`outlet_id`),
|
|
KEY `outlet_id` (`outlet_id`),
|
|
CONSTRAINT `user_outlets_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
|
|
CONSTRAINT `user_outlets_ibfk_2` FOREIGN KEY (`outlet_id`) REFERENCES `outlets` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `user_outlets`
|
|
--
|
|
|
|
LOCK TABLES `user_outlets` WRITE;
|
|
/*!40000 ALTER TABLE `user_outlets` DISABLE KEYS */;
|
|
INSERT INTO `user_outlets` VALUES
|
|
(1,1),
|
|
(1,2),
|
|
(1,3),
|
|
(1,4),
|
|
(2,1),
|
|
(3,2);
|
|
/*!40000 ALTER TABLE `user_outlets` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `users`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `users`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `users` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`group_id` int(11) DEFAULT NULL,
|
|
`username` varchar(255) NOT NULL,
|
|
`password` varchar(255) NOT NULL,
|
|
`full_name` varchar(255) DEFAULT NULL,
|
|
`employee_id` varchar(50) DEFAULT NULL,
|
|
`email` varchar(255) DEFAULT NULL,
|
|
`profile_pic` varchar(255) DEFAULT NULL,
|
|
`is_active` tinyint(1) DEFAULT 1,
|
|
`is_ratable` tinyint(1) DEFAULT 0,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `username` (`username`),
|
|
UNIQUE KEY `employee_id` (`employee_id`),
|
|
UNIQUE KEY `email` (`email`),
|
|
KEY `group_id` (`group_id`),
|
|
CONSTRAINT `users_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `user_groups` (`id`) ON DELETE SET NULL
|
|
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `users`
|
|
--
|
|
|
|
LOCK TABLES `users` WRITE;
|
|
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
|
|
INSERT INTO `users` VALUES
|
|
(1,1,'admin','$2y$10$52ZJ3bcFXYY8B7pcWL/9LeY90Fd3M1eAIolOGG.XpXa50zBmwFSuS','Super Admin',NULL,NULL,NULL,1,0,'2026-02-23 18:56:57'),
|
|
(2,2,'cashier1','$2y$10$2.LYIJUOfkoiqkjtLtPe3uMLAAF6o4WmjinqXAuuWt72EYeQ8ZMQG','Alice Cashier',NULL,NULL,NULL,1,0,'2026-02-23 19:48:28'),
|
|
(3,3,'waiter1','$2y$10$2.LYIJUOfkoiqkjtLtPe3uMLAAF6o4WmjinqXAuuWt72EYeQ8ZMQG','Bob Waiter',NULL,NULL,NULL,1,0,'2026-02-23 19:48:28');
|
|
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
|
|
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
|
|
|
-- Dump completed on 2026-02-24 5:08:07
|