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

START TRANSACTION;



--
-- Database: `db_skripsi_heri`
--

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

--
-- Table structure for table `businesses`
--

CREATE TABLE `businesses` (
  `id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `business_type` enum('warung_makan','warung_kelontong') COLLATE utf8mb4_unicode_ci NOT NULL,
  `daily_transaction_estimate` smallint UNSIGNED NOT NULL DEFAULT '0',
  `signature_products` text COLLATE utf8mb4_unicode_ci,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `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 `businesses`
--

INSERT INTO `businesses` (`id`, `name`, `business_type`, `daily_transaction_estimate`, `signature_products`, `address`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Warung Doyok', 'warung_makan', 100, 'Soto ayam, gulai daging sapi, aneka minuman, gorengan', 'Surabaya', 1, '2026-03-16 20:34:06', '2026-03-16 20:34:06'),
(2, 'Warung Cak Mun / Herawati', 'warung_makan', 100, 'Rawon balungan, pecel, krengsengan, bali, aneka minuman', 'Surabaya', 1, '2026-03-16 20:34:06', '2026-03-16 20:34:06'),
(3, 'Warung Pawon Asri', 'warung_makan', 50, 'Nasi campur, nasi sayur, mie ayam, es campur, es teler, es blewah', 'Surabaya', 1, '2026-03-16 20:34:06', '2026-03-16 20:34:06'),
(4, 'Warung Cak Wan', 'warung_kelontong', 50, 'Rokok dan aneka minuman', 'Surabaya', 1, '2026-03-16 20:34:06', '2026-03-16 20:34:06');

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

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `user_id` bigint UNSIGNED NOT NULL,
  `type` enum('bahan baku','operasional','lainnya') COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` date NOT 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 `expenses`
--

INSERT INTO `expenses` (`id`, `business_id`, `user_id`, `type`, `amount`, `description`, `date`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 'bahan baku', 350000.00, 'Belanja bahan baku mingguan - Admin Warung Doyok', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 1, 1, 'operasional', 150000.00, 'Biaya operasional harian - Admin Warung Doyok', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(3, 2, 3, 'bahan baku', 350000.00, 'Belanja bahan baku mingguan - Admin Cak Mun', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(4, 2, 3, 'operasional', 150000.00, 'Biaya operasional harian - Admin Cak Mun', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(5, 3, 4, 'bahan baku', 350000.00, 'Belanja bahan baku mingguan - Admin Pawon Asri', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(6, 3, 4, 'operasional', 150000.00, 'Biaya operasional harian - Admin Pawon Asri', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(7, 4, 5, 'bahan baku', 350000.00, 'Belanja bahan baku mingguan - Admin Cak Wan', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(8, 4, 5, 'operasional', 150000.00, 'Biaya operasional harian - Admin Cak Wan', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09');

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

--
-- Table structure for table `ingredients`
--

CREATE TABLE `ingredients` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `unit` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `stock` decimal(12,2) NOT NULL DEFAULT '0.00',
  `min_stock` decimal(12,2) NOT NULL DEFAULT '0.00',
  `description` varchar(255) COLLATE utf8mb4_unicode_ci 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 `ingredients`
--

INSERT INTO `ingredients` (`id`, `business_id`, `name`, `unit`, `stock`, `min_stock`, `description`, `created_at`, `updated_at`) VALUES
(1, 2, 'Beras', 'kg', 50.00, 10.00, 'Bahan pokok nasi', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 2, 'Ayam', 'kg', 30.00, 8.00, 'Bahan utama menu ayam', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(3, 2, 'Minyak Goreng', 'liter', 20.00, 5.00, 'Bahan untuk menggoreng', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(4, 2, 'Gula', 'kg', 10.00, 3.00, 'Pemanis minuman', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(5, 4, 'Stok Rokok Filter A', 'bungkus', 120.00, 20.00, 'Persediaan rokok filter A', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(6, 4, 'Stok Rokok Kretek B', 'bungkus', 100.00, 20.00, 'Persediaan rokok kretek B', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(7, 4, 'Stok Air Mineral', 'botol', 200.00, 50.00, 'Persediaan air mineral', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(8, 1, 'Beras', 'kg', 50.00, 10.00, 'Bahan pokok nasi', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(9, 1, 'Ayam', 'kg', 30.00, 8.00, 'Bahan utama menu ayam', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(10, 1, 'Minyak Goreng', 'liter', 20.00, 5.00, 'Bahan untuk menggoreng', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(11, 1, 'Gula', 'kg', 10.00, 3.00, 'Pemanis minuman', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(12, 3, 'Beras', 'kg', 50.00, 10.00, 'Bahan pokok nasi', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(13, 3, 'Ayam', 'kg', 30.00, 8.00, 'Bahan utama menu ayam', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(14, 3, 'Minyak Goreng', 'liter', 20.00, 5.00, 'Bahan untuk menggoreng', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(15, 3, 'Gula', 'kg', 10.00, 3.00, 'Pemanis minuman', '2026-03-16 20:34:09', '2026-03-16 20:34:09');

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

--
-- Table structure for table `menus`
--

CREATE TABLE `menus` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `price` decimal(12,2) NOT NULL,
  `menu_category_id` bigint UNSIGNED NOT NULL,
  `item_type` enum('makanan','minuman','gorengan','rokok','lainnya') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'lainnya',
  `sku` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_stock_tracked` tinyint(1) NOT NULL DEFAULT '1',
  `status` enum('tersedia','tidak') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'tersedia',
  `image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `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 `menus`
--

INSERT INTO `menus` (`id`, `business_id`, `name`, `price`, `menu_category_id`, `item_type`, `sku`, `is_stock_tracked`, `status`, `image`, `description`, `created_at`, `updated_at`) VALUES
(1, 1, 'Soto Ayam', 18000.00, 6, 'makanan', NULL, 1, 'tersedia', NULL, 'Soto ayam khas warung doyok', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 1, 'Gulai Daging Sapi', 25000.00, 6, 'makanan', NULL, 1, 'tersedia', NULL, 'Gulai daging sapi', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(3, 1, 'Es Teh Manis', 6000.00, 7, 'minuman', NULL, 1, 'tersedia', NULL, 'Minuman segar', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(4, 1, 'Gorengan Campur', 5000.00, 8, 'gorengan', NULL, 1, 'tersedia', NULL, 'Aneka gorengan', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(5, 2, 'Rawon Balungan', 22000.00, 1, 'makanan', NULL, 1, 'tersedia', NULL, 'Rawon balungan khas', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(6, 2, 'Pecel', 15000.00, 1, 'makanan', NULL, 1, 'tersedia', NULL, 'Pecel sayur', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(7, 2, 'Krengsengan', 21000.00, 1, 'makanan', NULL, 1, 'tersedia', NULL, 'Krengsengan daging', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(8, 2, 'Es Jeruk', 7000.00, 2, 'minuman', NULL, 1, 'tersedia', NULL, 'Jeruk segar', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(9, 3, 'Nasi Campur', 17000.00, 9, 'makanan', NULL, 1, 'tersedia', NULL, 'Nasi campur komplit', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(10, 3, 'Mie Ayam', 15000.00, 9, 'makanan', NULL, 1, 'tersedia', NULL, 'Mie ayam porsi reguler', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(11, 3, 'Es Campur', 10000.00, 10, 'minuman', NULL, 1, 'tersedia', NULL, 'Es campur segar', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(12, 3, 'Es Teler', 12000.00, 10, 'minuman', NULL, 1, 'tersedia', NULL, 'Es teler spesial', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(13, 4, 'Rokok Filter A', 28000.00, 4, 'rokok', 'RKA-12', 1, 'tersedia', NULL, 'Rokok filter kemasan 12', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(14, 4, 'Rokok Kretek B', 23000.00, 4, 'rokok', 'RKB-12', 1, 'tersedia', NULL, 'Rokok kretek kemasan 12', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(15, 4, 'Air Mineral 600ml', 5000.00, 5, 'minuman', 'AM-600', 1, 'tersedia', NULL, 'Air mineral botol', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(16, 4, 'Teh Botol', 7000.00, 5, 'minuman', 'TB-450', 1, 'tersedia', NULL, 'Minuman teh kemasan botol', '2026-03-16 20:34:09', '2026-03-16 20:34:09');

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

--
-- Table structure for table `menu_categories`
--

CREATE TABLE `menu_categories` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci 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 `menu_categories`
--

INSERT INTO `menu_categories` (`id`, `business_id`, `name`, `description`, `created_at`, `updated_at`) VALUES
(1, 2, 'Makanan Utama', 'Menu makanan berat harian', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 2, 'Minuman', 'Minuman panas dan dingin', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(3, 2, 'Camilan', 'Makanan ringan', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(4, 4, 'Rokok', 'Berbagai merek rokok', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(5, 4, 'Minuman', 'Minuman kemasan dan sachet', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(6, 1, 'Makanan Utama', 'Menu makanan berat harian', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(7, 1, 'Minuman', 'Minuman panas dan dingin', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(8, 1, 'Camilan', 'Makanan ringan', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(9, 3, 'Makanan Utama', 'Menu makanan berat harian', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(10, 3, 'Minuman', 'Minuman panas dan dingin', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(11, 3, 'Camilan', 'Makanan ringan', '2026-03-16 20:34:09', '2026-03-16 20:34:09');

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

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

CREATE TABLE `migrations` (
  `id` int UNSIGNED NOT NULL,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int 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_roles_table', 1),
(2, '0001_01_01_000000_create_users_table', 1),
(3, '2026_03_17_024950_create_menu_categories_table', 1),
(4, '2026_03_17_024951_create_menus_table', 1),
(5, '2026_03_17_024953_create_ingredients_table', 1),
(6, '2026_03_17_024954_create_stocks_table', 1),
(7, '2026_03_17_024955_create_transactions_table', 1),
(8, '2026_03_17_024956_create_expenses_table', 1),
(9, '2026_03_17_024957_create_transaction_items_table', 1),
(10, '2026_03_17_040100_create_businesses_table', 1),
(11, '2026_03_17_040101_add_business_scope_to_core_tables', 1),
(12, '2026_03_17_034638_create_cache_table', 2);

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

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

CREATE TABLE `roles` (
  `id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `permissions` json 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 `roles`
--

INSERT INTO `roles` (`id`, `name`, `code`, `description`, `permissions`, `created_at`, `updated_at`) VALUES
(1, 'Admin', 'admin', 'Akses penuh: kelola pengguna, menu, stok, transaksi, pengeluaran, dan laporan.', '[\"users.manage\", \"menus.manage\", \"stocks.manage\", \"transactions.manage\", \"expenses.manage\", \"reports.view\", \"dashboard.view\"]', '2026-03-16 20:34:06', '2026-03-16 20:34:06'),
(2, 'Kasir', 'kasir', 'Akses kasir: transaksi penjualan, lihat menu, dan cetak struk.', '[\"transactions.create\", \"transactions.view\", \"menus.view\", \"receipt.print\", \"dashboard.basic_view\"]', '2026-03-16 20:34:06', '2026-03-16 20:34:06');

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

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

CREATE TABLE `sessions` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` bigint UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_activity` int 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
('qL9miyzKs4nn0goJQnUqjoXWKLrpMtaQQbdmSjsw', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiWUhhbE1EazVPQ1VnQTVZQWFlc3FTYmFqR052RldVdk5DTUFMT3VWbCI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzE6Imh0dHBzOi8vc2tyaXBzaS1oZXJpLnRlc3QvbG9naW4iO3M6NToicm91dGUiO3M6NToibG9naW4iO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19', 1775545860),
('vUsOtIn1EvhjUPJ3oYG0gqO05SNgh6anMFtyIvuW', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoia0c3T3p3Y0JLMk9XSTNqUDB1aVNFTVFVSDJQMUNMa09LMzk3UTZlOCI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzE6Imh0dHBzOi8vc2tyaXBzaS1oZXJpLnRlc3QvbG9naW4iO3M6NToicm91dGUiO3M6NToibG9naW4iO319', 1774604708);

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

--
-- Table structure for table `stocks`
--

CREATE TABLE `stocks` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `ingredient_id` bigint UNSIGNED NOT NULL,
  `type` enum('in','out','retur','rusak') COLLATE utf8mb4_unicode_ci NOT NULL,
  `quantity` decimal(12,2) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_id` bigint 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 `transactions`
--

CREATE TABLE `transactions` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `user_id` bigint UNSIGNED NOT NULL,
  `total` decimal(12,2) NOT NULL,
  `payment_method` enum('tunai','non-tunai') COLLATE utf8mb4_unicode_ci NOT NULL,
  `paid_amount` decimal(12,2) NOT NULL,
  `change` decimal(12,2) NOT NULL,
  `note` varchar(255) COLLATE utf8mb4_unicode_ci 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 `transactions`
--

INSERT INTO `transactions` (`id`, `business_id`, `user_id`, `total`, `payment_method`, `paid_amount`, `change`, `note`, `created_at`, `updated_at`) VALUES
(1, 4, 6, 74000.00, 'tunai', 100000.00, 26000.00, 'Seeder transaksi awal - Warung Cak Wan', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 1, 2, 68000.00, 'tunai', 100000.00, 32000.00, 'Seeder transaksi awal - Warung Doyok', '2026-03-16 20:34:09', '2026-03-16 20:34:09');

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

--
-- Table structure for table `transaction_items`
--

CREATE TABLE `transaction_items` (
  `id` bigint UNSIGNED NOT NULL,
  `transaction_id` bigint UNSIGNED NOT NULL,
  `menu_id` bigint UNSIGNED NOT NULL,
  `quantity` int NOT NULL,
  `price` decimal(12,2) NOT NULL,
  `subtotal` decimal(12,2) NOT 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 `transaction_items`
--

INSERT INTO `transaction_items` (`id`, `transaction_id`, `menu_id`, `quantity`, `price`, `subtotal`, `created_at`, `updated_at`) VALUES
(1, 1, 13, 1, 28000.00, 28000.00, '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 1, 14, 2, 23000.00, 46000.00, '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(3, 2, 1, 1, 18000.00, 18000.00, '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(4, 2, 2, 2, 25000.00, 50000.00, '2026-03-16 20:34:09', '2026-03-16 20:34:09');

--
-- Indexes for dumped tables
--

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

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `expenses_user_id_foreign` (`user_id`),
  ADD KEY `expenses_business_id_foreign` (`business_id`);

--
-- Indexes for table `ingredients`
--
ALTER TABLE `ingredients`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ingredients_business_id_foreign` (`business_id`);

--
-- Indexes for table `menus`
--
ALTER TABLE `menus`
  ADD PRIMARY KEY (`id`),
  ADD KEY `menus_menu_category_id_foreign` (`menu_category_id`),
  ADD KEY `menus_business_id_foreign` (`business_id`);

--
-- Indexes for table `menu_categories`
--
ALTER TABLE `menu_categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `menu_categories_business_id_foreign` (`business_id`);

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

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_name_unique` (`name`),
  ADD UNIQUE KEY `roles_code_unique` (`code`);

--
-- 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 `stocks`
--
ALTER TABLE `stocks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stocks_ingredient_id_foreign` (`ingredient_id`),
  ADD KEY `stocks_user_id_foreign` (`user_id`),
  ADD KEY `stocks_business_id_foreign` (`business_id`);

--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transactions_user_id_foreign` (`user_id`),
  ADD KEY `transactions_business_id_foreign` (`business_id`);

--
-- Indexes for table `transaction_items`
--
ALTER TABLE `transaction_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transaction_items_transaction_id_foreign` (`transaction_id`),
  ADD KEY `transaction_items_menu_id_foreign` (`menu_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `businesses`
--
ALTER TABLE `businesses`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `expenses`
--
ALTER TABLE `expenses`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `ingredients`
--
ALTER TABLE `ingredients`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `menus`
--
ALTER TABLE `menus`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `menu_categories`
--
ALTER TABLE `menu_categories`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `stocks`
--
ALTER TABLE `stocks`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `transaction_items`
--
ALTER TABLE `transaction_items`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `expenses`
--
ALTER TABLE `expenses`
  ADD CONSTRAINT `expenses_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `expenses_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `ingredients`
--
ALTER TABLE `ingredients`
  ADD CONSTRAINT `ingredients_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `menus`
--
ALTER TABLE `menus`
  ADD CONSTRAINT `menus_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `menus_menu_category_id_foreign` FOREIGN KEY (`menu_category_id`) REFERENCES `menu_categories` (`id`);

--
-- Constraints for table `menu_categories`
--
ALTER TABLE `menu_categories`
  ADD CONSTRAINT `menu_categories_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `stocks`
--
ALTER TABLE `stocks`
  ADD CONSTRAINT `stocks_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stocks_ingredient_id_foreign` FOREIGN KEY (`ingredient_id`) REFERENCES `ingredients` (`id`),
  ADD CONSTRAINT `stocks_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `transactions`
--
ALTER TABLE `transactions`
  ADD CONSTRAINT `transactions_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `transactions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `transaction_items`
--
ALTER TABLE `transaction_items`
  ADD CONSTRAINT `transaction_items_menu_id_foreign` FOREIGN KEY (`menu_id`) REFERENCES `menus` (`id`),
  ADD CONSTRAINT `transaction_items_transaction_id_foreign` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`);
COMMIT;

