-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `absoluteitb`
--

-- --------------------------------------------------------

--
-- Table structure for table `brands`
--

CREATE TABLE `brands` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `status` enum('Active','Inactive') NOT NULL DEFAULT 'Active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `brands`
--

INSERT INTO `brands` (`id`, `name`, `description`, `status`, `created_at`, `updated_at`) VALUES
(1, 'NGING LIVE', NULL, 'Active', '2025-09-29 12:27:58', '2025-09-29 12:27:58'),
(2, 'AIRPHO', NULL, 'Active', '2025-09-29 12:33:19', '2025-09-29 12:33:19'),
(4, 'T&G', NULL, 'Active', '2025-09-29 12:33:41', '2025-09-29 12:33:41'),
(5, 'PANDA', NULL, 'Active', '2025-09-29 12:33:52', '2025-09-29 12:33:52'),
(6, 'PXN', NULL, 'Active', '2025-09-29 12:34:23', '2025-09-29 12:34:23'),
(7, 'APPLE', NULL, 'Active', '2025-09-29 12:34:36', '2025-09-29 12:34:36');

-- --------------------------------------------------------

--
-- Table structure for table `damages`
--

CREATE TABLE `damages` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `current_quantity` int(11) NOT NULL DEFAULT 0,
  `damaged_quantity` int(11) NOT NULL,
  `balance_quantity` int(11) NOT NULL DEFAULT 0,
  `unit_cost` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `added_date` date DEFAULT NULL,
  `remarks` varchar(255) DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

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

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `queue` varchar(255) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) UNSIGNED NOT NULL,
  `reserved_at` int(10) UNSIGNED DEFAULT NULL,
  `available_at` int(10) UNSIGNED NOT NULL,
  `created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `job_batches`
--

CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

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

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '0001_01_01_000000_create_users_table', 1),
(2, '0001_01_01_000001_create_cache_table', 1),
(3, '0001_01_01_000002_create_jobs_table', 1),
(4, '2025_09_29_173705_create_brands_table', 2),
(5, '2025_09_29_193049_create_product_categories_table', 3),
(7, '2025_09_29_202931_create_product_models_table', 5),
(8, '2025_09_29_213327_create_suppliers_table', 6),
(9, '2025_09_29_213509_create_products_table', 7),
(10, '2025_09_29_221306_create_warehouses_table', 8),
(11, '2025_09_29_225353_create_product_warehouse_stocks_table', 9),
(12, '2025_09_29_225438_create_stock_movements_table', 9),
(13, '2025_09_29_232915_create_product_price_upadate_logs_table', 10),
(14, '2025_09_30_005035_create_damages_table', 11);

-- --------------------------------------------------------

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

CREATE TABLE `products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `brand_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_model_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `supplier_id` bigint(20) UNSIGNED DEFAULT NULL,
  `code` varchar(255) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `unit` enum('PCS','CARTON','SET','KG','TON','LTR','DOZZEN','PACKET','BOTTLE','BAG','Safety','INCH','FEET') NOT NULL DEFAULT 'PCS',
  `purchase_price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `wholesale_price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `sale_price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `discount_percent` decimal(5,2) NOT NULL DEFAULT 0.00,
  `stock_quantity` int(11) NOT NULL DEFAULT 0,
  `reorder_level` int(11) NOT NULL DEFAULT 0,
  `rack` varchar(255) DEFAULT NULL,
  `warranty_days` int(11) DEFAULT NULL,
  `status` enum('Active','Inactive') NOT NULL DEFAULT 'Active',
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `products` (`id`, `brand_id`, `product_model_id`, `product_category_id`, `supplier_id`, `code`, `name`, `unit`, `purchase_price`, `wholesale_price`, `sale_price`, `discount_percent`, `stock_quantity`, `reorder_level`, `rack`, `warranty_days`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 2, 2, 7, NULL, NULL, 'TX 10 PRO 4 CORE 16GB 256GB 8K UHD ANDRIOD TV BOX', 'PCS', 100.00, 134.00, 121.00, 10.00, 0, 3, NULL, NULL, 'Active', 1, 1, '2025-09-29 15:50:09', '2025-09-29 15:50:09'),
(2, 2, 2, 1, NULL, '434', 'LAPTOP BAG', 'PCS', 122.00, 43.00, 134.00, 13.00, 201, 53, NULL, NULL, 'Active', 1, 1, '2025-09-29 15:51:30', '2025-09-29 19:14:29'),
(3, 2, 2, 1, NULL, '34', 'POWER CABLE 1.5M FUSE', 'PCS', 355.00, 23.00, 652.00, 23.00, 0, 10, NULL, NULL, 'Active', 1, 1, '2025-09-29 15:52:19', '2025-09-29 15:52:19'),
(4, 2, 2, 7, NULL, '132', 'test', 'PCS', 12.00, 3.00, 34.00, 0.00, 0, 0, NULL, NULL, 'Active', 1, 1, '2025-09-29 19:37:43', '2025-09-29 19:37:43'),
(5, 4, 1, NULL, NULL, '100', 'TX 2000', 'PCS', 12.36, 13.78, 14.97, 10.00, 0, 5, '1', 365, 'Active', 1, 1, '2025-09-30 02:26:05', '2025-09-30 02:26:05');

-- --------------------------------------------------------

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

CREATE TABLE `product_categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'Active',
  `description` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `product_categories` (`id`, `name`, `status`, `description`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'LAPTOP BAG', 'Active', NULL, '2025-09-29 13:55:16', '2025-09-29 13:55:16', NULL),
(2, 'POWER CABLE', 'Active', NULL, '2025-09-29 13:55:40', '2025-09-29 13:55:40', NULL),
(3, 'VGA CABLE', 'Active', NULL, '2025-09-29 13:58:47', '2025-09-29 13:58:47', NULL),
(4, 'MOBILE STAND', 'Active', NULL, '2025-09-29 13:59:05', '2025-09-29 13:59:05', NULL),
(5, 'GADGETS', 'Active', NULL, '2025-09-29 13:59:23', '2025-09-29 13:59:23', NULL),
(6, 'REPETER', 'Active', NULL, '2025-09-29 13:59:41', '2025-09-29 13:59:41', NULL),
(7, 'ANTIVIRUS', 'Active', NULL, '2025-09-29 14:00:01', '2025-09-29 14:00:01', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `product_models`
--

CREATE TABLE `product_models` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'Active',
  `description` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_models`
--

INSERT INTO `product_models` (`id`, `name`, `status`, `description`, `created_at`, `updated_at`) VALUES
(1, 'TX 10 PRO', 'Active', NULL, '2025-09-29 14:30:07', '2025-09-29 14:30:07'),
(2, 'ABSOLUTE LAPTOP BAG', 'Active', NULL, '2025-09-29 14:31:46', '2025-09-29 14:31:46');

-- --------------------------------------------------------

--
-- Table structure for table `product_price_update_logs`
--

CREATE TABLE `product_price_update_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `brand_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `mode` enum('taka','percent') NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `affect_purchase` tinyint(1) NOT NULL DEFAULT 0,
  `affect_wholesale` tinyint(1) NOT NULL DEFAULT 0,
  `affect_sale` tinyint(1) NOT NULL DEFAULT 0,
  `purchase_price_old` decimal(12,2) DEFAULT NULL,
  `purchase_price_new` decimal(12,2) DEFAULT NULL,
  `wholesale_price_old` decimal(12,2) DEFAULT NULL,
  `wholesale_price_new` decimal(12,2) DEFAULT NULL,
  `sale_price_old` decimal(12,2) DEFAULT NULL,
  `sale_price_new` decimal(12,2) DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `product_warehouse_stocks`
--

CREATE TABLE `product_warehouse_stocks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_warehouse_stocks`
--

INSERT INTO `product_warehouse_stocks` (`id`, `product_id`, `warehouse_id`, `quantity`, `created_at`, `updated_at`) VALUES
(1, 2, 2, 201, '2025-09-29 17:04:49', '2025-09-29 19:14:29'),
(2, 1, 2, 70, '2025-09-29 20:12:10', '2025-09-29 20:12:10');

-- --------------------------------------------------------

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sessions`
--

INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('1Gk7ZQo54HpEfX0pnVeUMtp8KUN3at0GWSIp7QyE', NULL, '88.201.15.4', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/28.0 Chrome/130.0.0.0 Mobile Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiVmJEQm82RnRNd0NldEhsekJuYkU4ek9ydGFoT09OendiQ1Rvc3hqcSI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDc6Imh0dHA6Ly8xNjQuMTMyLjE1MS4xODcvYWJzb2x1dGVpdGIvcHVibGljL2xvZ2luIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1759235073),
('cNvgenzZtNibqbLjz9jII7rgrQV0U7WOlgMmZvBI', NULL, '109.63.56.28', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiTVh4bEhhQ3JQeUxFbVBnSVRManB0a3JYVFQ1UklTQ3d5Uk5vR1ZPeSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czo1ODoiaHR0cDovLzE2NC4xMzIuMTUxLjE4Ny9hYnNvbHV0ZWl0Yi9wdWJsaWMvd2FyZWhvdXNlLzIvZWRpdCI7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjQ3OiJodHRwOi8vMTY0LjEzMi4xNTEuMTg3L2Fic29sdXRlaXRiL3B1YmxpYy9sb2dpbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1759235065),
('J4UALxDhk5TGPZ39xqhNi02u6VyBlXWjJcaaQoJY', NULL, '37.131.107.123', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoid1BscXo0SjJzZjF0bzlNSzVvVTZqYkJ3U01pSlFUbDhQQm1zTW5FdSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czo1ODoiaHR0cDovLzE2NC4xMzIuMTUxLjE4Ny9hYnNvbHV0ZWl0Yi9wdWJsaWMvd2FyZWhvdXNlLzIvZWRpdCI7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjQ3OiJodHRwOi8vMTY0LjEzMi4xNTEuMTg3L2Fic29sdXRlaXRiL3B1YmxpYy9sb2dpbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1760973323),
('KePY7n7UZeqPXk4PTMIB9fvIxRaD5ppvUSM5TE1d', 1, '37.131.109.99', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36', 'YTo2OntzOjY6Il90b2tlbiI7czo0MDoiMm5semxMbzNOTVFQQjNVc0VDWmFpSXIzSTIxRVpNSjBzSmFUc0hHZyI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czozOiJ1cmwiO2E6MDp7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjQxOiJodHRwOi8vMTY0LjEzMi4xNTEuMTg3L2Fic29sdXRlaXRiL3B1YmxpYyI7fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjE7czo0OiJhdXRoIjthOjE6e3M6MjE6InBhc3N3b3JkX2NvbmZpcm1lZF9hdCI7aToxNzU5MjIwMjY4O319', 1759224045),
('uh7KNGPvnGHwgIDGqhBelV1Yn41j0Fb5c0fwkePy', NULL, '62.209.24.5', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Mobile Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiWjJqVHVFRTJBWEg4ZHpmdDFnQkxjVGE5a3VBWmdCYllZRVE3blpreSI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDc6Imh0dHA6Ly8xNjQuMTMyLjE1MS4xODcvYWJzb2x1dGVpdGIvcHVibGljL2xvZ2luIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1761994891),
('WS72eUwR6FCYCN7LWJizO8cTz0yVKqGJzI771u2V', NULL, '37.131.107.123', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiWUF2S0xUTExHdE0zMFVoVnEwZ2Y2N3VIbVM0SGVFQ05zcTFCMzNpMiI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czo1ODoiaHR0cDovLzE2NC4xMzIuMTUxLjE4Ny9hYnNvbHV0ZWl0Yi9wdWJsaWMvd2FyZWhvdXNlLzIvZWRpdCI7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjQ3OiJodHRwOi8vMTY0LjEzMi4xNTEuMTg3L2Fic29sdXRlaXRiL3B1YmxpYy9sb2dpbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1761994870),
('ZPnDi29217roHAPJY7S6VfyjHDKyawXANw22VLVC', 1, '103.174.188.68', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36', 'YTo1OntzOjY6Il90b2tlbiI7czo0MDoiTnJmMkg2eWlTeWRneXRxNEc0TEpUSkJsWlg1OTN1RHliYW9CZVNlWSI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDE6Imh0dHA6Ly8xNjQuMTMyLjE1MS4xODcvYWJzb2x1dGVpdGIvcHVibGljIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo1MDoibG9naW5fd2ViXzU5YmEzNmFkZGMyYjJmOTQwMTU4MGYwMTRjN2Y1OGVhNGUzMDk4OWQiO2k6MTtzOjQ6ImF1dGgiO2E6MTp7czoyMToicGFzc3dvcmRfY29uZmlybWVkX2F0IjtpOjE3NTkyMTczNDQ7fX0=', 1759221188);

-- --------------------------------------------------------

--
-- Table structure for table `stock_movements`
--

CREATE TABLE `stock_movements` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('purchase','purchase_return','sale','sale_return','stock_in','stock_out','damage') NOT NULL,
  `action` enum('increase','decrease','set') NOT NULL,
  `quantity_change` int(11) NOT NULL,
  `stock_after` int(11) NOT NULL,
  `price` decimal(12,2) DEFAULT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `remarks` varchar(255) DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_movements`
--

INSERT INTO `stock_movements` (`id`, `product_id`, `warehouse_id`, `type`, `action`, `quantity_change`, `stock_after`, `price`, `barcode`, `remarks`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 2, 2, 'stock_in', 'increase', 100, 100, NULL, NULL, NULL, 1, '2025-09-28 18:00:00', '2025-09-29 17:04:49'),
(2, 2, 2, 'stock_in', 'increase', 120, 220, NULL, NULL, NULL, 1, '2025-09-28 18:00:00', '2025-09-29 17:04:58'),
(3, 2, 2, 'damage', 'decrease', -10, 210, NULL, NULL, NULL, 1, '2025-09-29 19:08:56', '2025-09-29 19:08:56'),
(4, 2, 2, 'damage', 'decrease', -2, 208, NULL, NULL, NULL, 1, '2025-09-29 18:00:00', '2025-09-29 19:12:29'),
(5, 2, 2, 'damage', 'decrease', -7, 201, NULL, NULL, NULL, 1, '2025-09-29 18:00:00', '2025-09-29 19:14:29'),
(6, 1, 2, 'stock_in', 'increase', 70, 70, NULL, NULL, NULL, 1, '2025-09-29 18:00:00', '2025-09-29 20:12:10');

-- --------------------------------------------------------

--
-- Table structure for table `suppliers`
--

CREATE TABLE `suppliers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `contact_person` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `city` varchar(255) DEFAULT NULL,
  `state` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `warehouses`
--

CREATE TABLE `warehouses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `number` varchar(255) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `address` varchar(255) DEFAULT NULL,
  `type` enum('Company Property','Rent') NOT NULL DEFAULT 'Company Property',
  `owner_name` varchar(255) DEFAULT NULL,
  `owner_address` varchar(255) DEFAULT NULL,
  `owner_mobile` varchar(255) DEFAULT NULL,
  `advance` decimal(12,2) NOT NULL DEFAULT 0.00,
  `rent` decimal(12,2) NOT NULL DEFAULT 0.00,
  `payment_date` date DEFAULT NULL,
  `starting_date` date DEFAULT NULL,
  `ending_date` date DEFAULT NULL,
  `staff_id` bigint(20) UNSIGNED DEFAULT NULL,
  `status` enum('Active','Inactive') NOT NULL DEFAULT 'Active',
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `warehouses`
--

INSERT INTO `warehouses` (`id`, `number`, `name`, `address`, `type`, `owner_name`, `owner_address`, `owner_mobile`, `advance`, `rent`, `payment_date`, `starting_date`, `ending_date`, `staff_id`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(2, '1', 'WAREHOUSE', 'SK Sharif Uddin Super Market', 'Rent', 'Md Mahbubur Rahman', 'Jamil Nagor, Bogura', '018888888', 0.00, 0.00, NULL, NULL, NULL, NULL, 'Active', 1, 1, '2025-09-29 16:32:54', '2025-09-29 23:05:12'),
(3, '2', 'Test', 'test', 'Company Property', 'test', 'test', '666', 0.00, 0.00, '2025-09-30', '2025-09-30', '2025-09-30', 1, 'Active', 1, NULL, '2025-09-30 02:38:49', '2025-09-30 02:38:49');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `brands`
--
ALTER TABLE `brands`
  ADD PRIMARY KEY (`id`),
  ADD KEY `brands_name_index` (`name`),
  ADD KEY `brands_status_index` (`status`);

--
-- Indexes for table `damages`
--
ALTER TABLE `damages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `damages_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `damages_user_id_foreign` (`user_id`),
  ADD KEY `damages_product_id_warehouse_id_added_date_index` (`product_id`,`warehouse_id`,`added_date`);

--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indexes for table `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- Indexes for table `job_batches`
--
ALTER TABLE `job_batches`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_products_brand` (`brand_id`),
  ADD KEY `fk_products_model` (`product_model_id`),
  ADD KEY `fk_products_category` (`product_category_id`),
  ADD KEY `fk_products_supplier` (`supplier_id`),
  ADD KEY `fk_products_created_by` (`created_by`),
  ADD KEY `fk_products_updated_by` (`updated_by`),
  ADD KEY `products_code_index` (`code`),
  ADD KEY `products_name_index` (`name`),
  ADD KEY `products_status_index` (`status`);

--
-- Indexes for table `product_categories`
--
ALTER TABLE `product_categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `product_categories_name_unique` (`name`);

--
-- Indexes for table `product_models`
--
ALTER TABLE `product_models`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `product_models_name_unique` (`name`);

--
-- Indexes for table `product_price_update_logs`
--
ALTER TABLE `product_price_update_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_price_update_logs_brand_id_foreign` (`brand_id`),
  ADD KEY `product_price_update_logs_product_category_id_foreign` (`product_category_id`),
  ADD KEY `product_price_update_logs_user_id_foreign` (`user_id`),
  ADD KEY `product_price_update_logs_product_id_created_at_index` (`product_id`,`created_at`);

--
-- Indexes for table `product_warehouse_stocks`
--
ALTER TABLE `product_warehouse_stocks`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `product_warehouse_stocks_product_id_warehouse_id_unique` (`product_id`,`warehouse_id`),
  ADD KEY `product_warehouse_stocks_warehouse_id_product_id_index` (`warehouse_id`,`product_id`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Indexes for table `stock_movements`
--
ALTER TABLE `stock_movements`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_movements_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `stock_movements_user_id_foreign` (`user_id`),
  ADD KEY `stock_movements_product_id_warehouse_id_created_at_index` (`product_id`,`warehouse_id`,`created_at`),
  ADD KEY `stock_movements_type_index` (`type`),
  ADD KEY `stock_movements_action_index` (`action`);

--
-- Indexes for table `suppliers`
--
ALTER TABLE `suppliers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `suppliers_name_unique` (`name`),
  ADD UNIQUE KEY `suppliers_email_unique` (`email`);

--
-- Indexes for table `warehouses`
--
ALTER TABLE `warehouses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `1` (`staff_id`),
  ADD KEY `warehouses_created_by_foreign` (`created_by`),
  ADD KEY `warehouses_updated_by_foreign` (`updated_by`),
  ADD KEY `warehouses_number_index` (`number`),
  ADD KEY `warehouses_status_index` (`status`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `brands`
--
ALTER TABLE `brands`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `damages`
--
ALTER TABLE `damages`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `product_categories`
--
ALTER TABLE `product_categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `product_models`
--
ALTER TABLE `product_models`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `product_price_update_logs`
--
ALTER TABLE `product_price_update_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `product_warehouse_stocks`
--
ALTER TABLE `product_warehouse_stocks`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `stock_movements`
--
ALTER TABLE `stock_movements`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `suppliers`
--
ALTER TABLE `suppliers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `warehouses`
--
ALTER TABLE `warehouses`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `damages`
--
ALTER TABLE `damages`
  ADD CONSTRAINT `damages_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `damages_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `damages_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `fk_products_brand` FOREIGN KEY (`brand_id`) REFERENCES `brands` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_products_category` FOREIGN KEY (`product_category_id`) REFERENCES `product_categories` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_products_created_by` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_products_model` FOREIGN KEY (`product_model_id`) REFERENCES `product_models` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_products_supplier` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_products_updated_by` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `product_price_update_logs`
--
ALTER TABLE `product_price_update_logs`
  ADD CONSTRAINT `product_price_update_logs_brand_id_foreign` FOREIGN KEY (`brand_id`) REFERENCES `brands` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `product_price_update_logs_product_category_id_foreign` FOREIGN KEY (`product_category_id`) REFERENCES `product_categories` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `product_price_update_logs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_price_update_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `product_warehouse_stocks`
--
ALTER TABLE `product_warehouse_stocks`
  ADD CONSTRAINT `product_warehouse_stocks_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_warehouse_stocks_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_movements`
--
ALTER TABLE `stock_movements`
  ADD CONSTRAINT `stock_movements_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stock_movements_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_movements_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `warehouses`
--
ALTER TABLE `warehouses`
  ADD CONSTRAINT `1` FOREIGN KEY (`staff_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `warehouses_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `warehouses_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;
COMMIT;

