--
-- Host: localhost    Database: jewelry
-- ------------------------------------------------------


--
-- Table structure for table `currencies`
--

CREATE TABLE `currencies` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `currency_symbol` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `exchange_in_rate` double(15,4) NOT NULL DEFAULT '0.0000',
  `exchange_out_rate` double(15,4) NOT NULL DEFAULT '0.0000',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `is_based` tinyint(1) NOT NULL DEFAULT '1',
  `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '1',
  `user_id` bigint unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `currencies`
--

INSERT INTO `currencies` VALUES (1,'USD','$',1.0000,0.0000,1,1,'1',1,NULL,'2024-04-10 10:45:40','2024-05-29 05:57:13'),(2,'THB',NULL,36.0000,37.0000,1,0,'1',1,NULL,'2024-04-10 10:45:40','2024-04-10 10:48:03'),(3,'KHR',NULL,4000.0000,4100.0000,1,0,'1',1,NULL,'2024-04-10 10:46:20','2024-04-24 08:48:04');

--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `failed_jobs`
--


--
-- Table structure for table `main_categories`
--

CREATE TABLE `main_categories` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `weight` double(16,4) NOT NULL DEFAULT '0.0000',
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `main_categories`
--


--
-- Table structure for table `members`
--

CREATE TABLE `members` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `members`
--


--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` VALUES (1,'2014_10_12_000000_create_users_table',1),(2,'2014_10_12_100000_create_password_resets_table',1),(3,'2019_08_19_000000_create_failed_jobs_table',1),(4,'2019_12_14_000001_create_personal_access_tokens_table',1),(5,'2022_04_15_130146_create_permission_tables',1),(6,'2023_08_06_161442_create_currencies_table',1),(7,'2023_08_19_114315_create_settings_table',1),(8,'2024_04_17_134213_create_products_table',2),(15,'2024_04_19_135123_create_main_categories_table',3),(16,'2024_04_19_135131_create_product_categories_table',3),(17,'2024_04_19_135141_create_products_table',4),(18,'2024_04_19_135158_create_sales_table',4),(19,'2024_05_07_171112_add_column_wages_to_sale_table',5),(20,'2024_05_07_173808_add_column_to_product_table',5),(21,'2024_05_08_114751_add_column_invoice_to_product_table',6),(23,'2024_05_08_150657_add_column_sale_currency_id_to_table_sale',7),(24,'2024_05_16_112441_add_column_discount_to_table_sales',7),(25,'2024_05_29_113626_add_column_to_usd_exchange_rate_to_table_product_categories',8),(26,'2024_05_29_145146_modify_table_sales_table',8),(27,'2024_05_29_150930_add_column_to_table_sale',8),(28,'2024_05_31_104129_add_column_to_table_sale',9),(29,'2024_06_10_101859_modify_column_is_active_from_table_sale',10),(30,'2024_06_24_122415_add_column_to_table_product',11),(31,'2024_06_26_135550_create_product_category_prices_table',12),(32,'2024_06_27_130833_add_column_to_table_categories',12),(33,'2024_06_27_140507_create_products_readies_table',12),(34,'2024_06_27_162834_add_parent_id_product_categories_table',12),(35,'2024_07_02_172108_create_product_category_weight_histories_table',13),(36,'2024_07_11_141647_create_qty_histories_table',14),(37,'2024_07_11_145501_add_total_qty_to_products_table',14),(38,'2024_07_12_174744_add_grn_to_qty_histories_table',15),(39,'2024_07_12_191014_drop_table_product_category_weight_histories_table',16),(40,'2024_07_18_115530_add_column_original_wages_to_table_products',17),(41,'2024_07_18_150715_add_column_sales_prices_to_table_sales',17),(42,'2024_07_18_182915_create_members_table',18),(43,'2024_07_18_183625_add_column_member_id_to_table_sales',18),(44,'2024_07_19_154750_add_column_discount_to_table_sales',18),(45,'2024_07_20_231558_add_column_already_buy_back_to_sales',18),(46,'2024_07_22_142017_add_column_store_buy_back_to_table_sale',19),(47,'2024_07_23_175108_create_product_attributes_table',19),(48,'2024_07_27_144102_create_sell_product_attribute',19),(49,'2024_07_27_165238_add_column_to_product_categories',19),(50,'2024_07_29_114844_add_column_to_sales_table',20),(51,'2024_07_29_164720_drop_column_product_id_from_table_sell_attribute',20),(52,'2024_07_31_171642_add_column_to_product_categories_table',20),(53,'2024_08_01_153524_add_column_original_wages_to_table_sales',21);

--
-- Table structure for table `model_has_permissions`
--

CREATE TABLE `model_has_permissions` (
  `permission_id` bigint unsigned NOT NULL,
  `model_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `model_id` bigint unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `model_has_permissions`
--


--
-- Table structure for table `model_has_roles`
--

CREATE TABLE `model_has_roles` (
  `role_id` bigint unsigned NOT NULL,
  `model_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `model_id` bigint unsigned NOT NULL,
  PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `model_has_roles`
--

INSERT INTO `model_has_roles` VALUES (1,'App\\Models\\User',1),(2,'App\\Models\\User',2),(3,'App\\Models\\User',3);

--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `guard_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permissions`
--

INSERT INTO `permissions` VALUES (1,'role-list','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(2,'role-create','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(3,'role-edit','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(4,'role-delete','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(5,'user-list','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(6,'user-create','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(7,'user-edit','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(8,'user-delete','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(9,'currency-list','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(10,'currency-create','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(11,'currency-edit','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(12,'currency-delete','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(13,'setting-list','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(14,'setting-create','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(15,'setting-edit','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(16,'setting-delete','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(17,'product-list','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(18,'product-create','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(19,'product-edit','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(20,'product-delete','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(21,'product-category-list','web','2024-05-27 08:33:35','2024-05-27 08:33:35'),(22,'product-category-create','web','2024-05-27 08:33:35','2024-05-27 08:33:35'),(23,'product-category-edit','web','2024-05-27 08:33:35','2024-05-27 08:33:35'),(24,'product-category-delete','web','2024-05-27 08:33:35','2024-05-27 08:33:35'),(25,'sale-list','web','2024-05-27 08:33:35','2024-05-27 08:33:35'),(26,'sale-delete','web','2024-05-27 08:33:35','2024-05-27 08:33:35'),(27,'report-list','web','2024-05-27 08:33:35','2024-05-27 08:33:35'),(28,'point-to-sale','web','2024-05-27 08:33:35','2024-05-27 08:33:35'),(29,'profile-list','web','2024-07-25 05:10:07','2024-07-25 05:10:07'),(30,'setup-list','web','2024-07-25 05:10:07','2024-07-25 05:10:07'),(31,'reports-category-list','web','2024-07-25 05:10:07','2024-07-25 05:10:07'),(32,'reports-sale-list','web','2024-07-25 05:10:07','2024-07-25 05:10:07'),(33,'reports-buy-back-list','web','2024-07-25 05:10:07','2024-07-25 05:10:07'),(34,'reports-grn-list','web','2024-07-25 05:10:07','2024-07-25 05:10:07'),(35,'reports-product-transaction-list','web','2024-07-25 05:10:07','2024-07-25 05:10:07'),(36,'reports-summary-list','web','2024-07-25 05:10:07','2024-07-25 05:10:07'),(37,'member-list','web','2024-07-25 05:10:07','2024-07-25 05:10:07');

--
-- Table structure for table `product_attributes`
--

CREATE TABLE `product_attributes` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `qty` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '1',
  `cost` double(16,2) NOT NULL DEFAULT '0.00',
  `price` double(16,2) NOT NULL DEFAULT '0.00',
  `product_id` bigint unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_attributes`
--


--
-- Table structure for table `product_categories`
--

CREATE TABLE `product_categories` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `user_id` bigint unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `to_usd_exchange_rate` double DEFAULT NULL,
  `icon` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `parent_id` bigint unsigned DEFAULT NULL,
  `is_main` tinyint(1) NOT NULL DEFAULT '1',
  `purity_level` double(8,2) DEFAULT NULL,
  `fixed_price` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_categories`
--

INSERT INTO `product_categories` VALUES (1,'ពេជ្រ',1,2,NULL,'2024-04-25 08:09:26','2024-07-29 07:25:39',0,'icon-png/1805897369473868.png',NULL,1,1.00,0),(2,'មាស',1,2,NULL,'2024-04-25 10:59:00','2024-08-06 03:09:45',280,'icon-png/1805897386464748.png',NULL,1,1.00,0),(3,'ផ្លាកទីន',1,2,NULL,'2024-04-25 10:59:13','2024-07-29 07:26:09',0,'icon-png/1805897401052864.png',NULL,1,1.00,0),(9,'ផ្លាកទីន ទឹក៧',1,2,NULL,'2024-06-28 10:08:52','2024-08-06 03:07:19',0,'icon-png/1805897416248468.png',3,0,0.70,0),(10,'ផ្លាកទីនទឹក៥',1,2,NULL,'2024-07-01 06:54:32','2024-08-06 03:07:24',0,'icon-png/1805897430829529.png',3,0,0.50,0),(11,'ផ្លាកទីនទឹក 3',1,2,NULL,'2024-07-29 07:22:13','2024-08-06 03:07:30',0,'',3,0,0.30,0),(12,'ផ្លាកទីនអ៊ីតាលី',1,2,NULL,'2024-07-29 07:22:32','2024-08-06 03:07:34',0,'icon-png/1805897577179747.png',3,0,0.75,0);

--
-- Table structure for table `product_category_prices`
--

CREATE TABLE `product_category_prices` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `product_category_id` bigint unsigned DEFAULT NULL,
  `price` double(16,2) NOT NULL,
  `user_id` bigint unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_category_prices`
--


--
-- Table structure for table `products`
--

CREATE TABLE `products` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `part_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `price` double(16,2) NOT NULL,
  `cost` double(16,2) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `description` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `image` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `weight` double(16,4) DEFAULT NULL,
  `product_category_id` bigint unsigned DEFAULT NULL,
  `user_id` bigint unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `qty` int NOT NULL DEFAULT '1',
  `diamond_size` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `invoice` int DEFAULT NULL,
  `wages` double NOT NULL,
  `for_sale` tinyint(1) NOT NULL DEFAULT '1',
  `original_wages` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `products`
--


--
-- Table structure for table `products_readies`
--

CREATE TABLE `products_readies` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `part_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `price` double(16,2) NOT NULL DEFAULT '0.00',
  `cost` double(16,2) NOT NULL DEFAULT '0.00',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `description` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `image` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `weight` double(16,4) NOT NULL,
  `product_category_id` bigint unsigned DEFAULT NULL,
  `user_id` bigint unsigned DEFAULT NULL,
  `grn` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `qty` int NOT NULL DEFAULT '0',
  `diamond_size` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `invoice` bigint DEFAULT NULL,
  `wages` double NOT NULL,
  `for_sale` tinyint(1) NOT NULL DEFAULT '1',
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `products_readies`
--


--
-- Table structure for table `qty_histories`
--

CREATE TABLE `qty_histories` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `qty` int NOT NULL DEFAULT '0',
  `qty_before_transaction` int NOT NULL DEFAULT '0',
  `qty_after_transaction` int NOT NULL DEFAULT '0',
  `product_id` bigint unsigned DEFAULT NULL,
  `user_id` bigint unsigned DEFAULT NULL,
  `note` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `grn` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `product_category_id` int DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `qty_histories`
--


--
-- Table structure for table `role_has_permissions`
--

CREATE TABLE `role_has_permissions` (
  `permission_id` bigint unsigned NOT NULL,
  `role_id` bigint unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`role_id`),
  KEY `role_has_permissions_role_id_foreign` (`role_id`),
  CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `role_has_permissions`
--

INSERT INTO `role_has_permissions` VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(36,1),(37,1),(1,2),(2,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2),(9,2),(10,2),(11,2),(12,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(17,3);

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `guard_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` VALUES (1,'Admin','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(2,'Supervisor','web','2024-04-10 10:45:40','2024-04-10 10:45:40'),(3,'Staff','web','2024-04-10 10:45:40','2024-04-10 10:45:40');

--
-- Table structure for table `sales`
--

CREATE TABLE `sales` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint unsigned DEFAULT NULL,
  `part_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `cost` double(16,2) NOT NULL,
  `description` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `image` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `weight` double(16,4) NOT NULL,
  `product_category_id` bigint unsigned DEFAULT NULL,
  `user_id` bigint unsigned DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `wages` double NOT NULL,
  `invoice_no` int NOT NULL,
  `grn` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `qty` int NOT NULL DEFAULT '1',
  `diamond_size` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `usd_amount` double DEFAULT NULL,
  `khr_amount` double DEFAULT NULL,
  `thb_amount` double DEFAULT NULL,
  `sales_price` double DEFAULT NULL,
  `member_id` bigint unsigned DEFAULT NULL,
  `discount` double(16,2) NOT NULL DEFAULT '0.00',
  `already_buy_back` tinyint(1) NOT NULL DEFAULT '0',
  `date_buy_back` timestamp NULL DEFAULT NULL,
  `buy_back_price` double(16,2) DEFAULT NULL,
  `buy_back_note` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `buy_by_user` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `to_usd_exchange_rate` double(16,2) DEFAULT NULL,
  `original_wages` double(16,2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=87 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sales`
--


--
-- Table structure for table `sell_product_attributes`
--

CREATE TABLE `sell_product_attributes` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `qty` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '1',
  `cost` double(16,2) NOT NULL DEFAULT '0.00',
  `price` double(16,2) NOT NULL DEFAULT '0.00',
  `sell_id` bigint unsigned NOT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sell_product_attributes`
--


--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `shop_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `fav_icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` int NOT NULL DEFAULT '1',
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `settings`
--

INSERT INTO `settings` VALUES (1,'Crown Jewelry','ភូមិក្បាលស្ពាន១ សង្កាត់ប៉ោយប៉ែត ក្រុងប៉ោយប៉ែត ខេត្តបន្ទាយមានជ័យ','012-XXX-XXX','logo.png','fav.ico',1,NULL,'2024-04-10 10:45:35','2024-04-17 06:37:34');


