-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 30, 2025 at 03:30 PM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!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 */;

--
-- Database: `billing`
--

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

--
-- Table structure for table `accounts`
--

CREATE TABLE `accounts` (
  `id` int(11) NOT NULL,
  `name` varchar(200) NOT NULL,
  `print_as` varchar(200) DEFAULT NULL,
  `group_name` varchar(100) NOT NULL,
  `opening_balance` decimal(12,2) DEFAULT 0.00,
  `drcr` enum('Dr','Cr') DEFAULT 'Dr',
  `address1` varchar(255) DEFAULT NULL,
  `address2` varchar(255) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `pincode` varchar(20) DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `mobile` varchar(20) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `email` varchar(150) DEFAULT NULL,
  `contact_person` varchar(150) DEFAULT NULL,
  `pan` varchar(20) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `accounts`
--

INSERT INTO `accounts` (`id`, `name`, `print_as`, `group_name`, `opening_balance`, `drcr`, `address1`, `address2`, `city`, `pincode`, `state`, `mobile`, `phone`, `email`, `contact_person`, `pan`, `created_at`) VALUES
(1, 'Shivam Enterprise', '20', 'SUPPLIERS', 1000.00, 'Cr', 'Home Cafe', 'Siliguri Institute Of Technology,sukna', 'SILIGURI', '734009', 'West Bengal', '8617608671', '', '', 'Shivam Das', '', '2025-12-29 15:12:45'),
(2, 'Shivam Enterprise', '20', 'SUPPLIERS', 1000.00, 'Cr', 'Home Cafe', 'Siliguri Institute Of Technology,sukna', 'SILIGURI', '734009', 'West Bengal', '8617608671', '', '', 'Shivam Das', '', '2025-12-29 15:13:12'),
(3, 'Shivam Enterprise', '20', 'SUPPLIERS', 1000.00, 'Cr', 'Home Cafe', 'Siliguri Institute Of Technology,sukna', 'SILIGURI', '734009', 'West Bengal', '8617608671', '', '', 'Shivam Das', '', '2025-12-29 15:14:04');

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

--
-- Table structure for table `categories`
--

CREATE TABLE `categories` (
  `id` int(11) NOT NULL,
  `business_id` int(11) DEFAULT NULL,
  `name` varchar(80) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `categories`
--

INSERT INTO `categories` (`id`, `business_id`, `name`, `is_active`) VALUES
(17, 10, 'Main Course', 1),
(18, 10, 'beverages', 1),
(20, 11, 'Main Course', 1);

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

--
-- Table structure for table `customer`
--

CREATE TABLE `customer` (
  `sno` int(11) NOT NULL,
  `business_id` int(11) DEFAULT NULL,
  `name` varchar(225) NOT NULL,
  `mobile_no` varchar(15) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `customer`
--

INSERT INTO `customer` (`sno`, `business_id`, `name`, `mobile_no`) VALUES
(5, NULL, 'Shivam Das', '8617608671'),
(6, NULL, 'Kiron', '12589631478'),
(7, NULL, 'Happy', '8614785296'),
(8, NULL, 'Happy', '8527419634'),
(9, NULL, 'Shivam', '9638527412'),
(10, NULL, 'Andaman', '9632587412'),
(11, NULL, 'Abcd', '8767867887'),
(14, NULL, 'Shivam', '456'),
(15, NULL, 'ayan', '9888300000'),
(16, NULL, 'Kiron', '846000000000000'),
(17, NULL, 'ayan', '908300000'),
(18, NULL, 'olive', '1234637725'),
(19, NULL, 'Ashwin', '147'),
(20, NULL, 'Subhadip', '7003246966'),
(21, NULL, 'Gdhdj', '9('),
(22, NULL, 'Sudip', '6297418660'),
(23, NULL, 'Shivam', '741852'),
(24, NULL, 'Shivam', '741258'),
(25, NULL, 'John', '85'),
(26, NULL, 'Gi', 'Tr'),
(27, NULL, 'Hhh', 'Gyy'),
(28, NULL, 'Sudip Ghosh', '6297418660'),
(29, NULL, 'Shivam', '8527419631'),
(30, NULL, 'Andaman', '9874563211'),
(31, NULL, 'Partha', '6397518660'),
(32, NULL, 'John', '00'),
(33, NULL, 'Yiig', '35'),
(34, NULL, 'A', '1'),
(35, NULL, 'A', '34'),
(36, NULL, 'Shivam', '123'),
(37, NULL, 'rahul', '8527419631'),
(38, NULL, 'Shivam Das', '7412589633'),
(39, NULL, 'Shivam Das', '1234567888'),
(40, NULL, 'Andaman', '7418529633'),
(41, NULL, 'Andaman', '7418529633'),
(42, NULL, 'Happy', '7418529633'),
(43, NULL, 'Shivam Das', '7412589633'),
(44, 9, 'Shivam', '1234567899'),
(45, 10, 'Shivam', '9874563216'),
(46, 10, 'Shivam', '7412589633'),
(47, 11, 'Shivam', '7412589633'),
(48, 11, '00', '1234567891'),
(49, 11, '123', '9874563211'),
(50, 11, '..', '9874563222'),
(51, 11, 'nxbc', '7412589633'),
(52, 11, '12', '9632587411'),
(53, 11, 'bhutiya', '1234567893'),
(54, 11, 'joy', '7458963211'),
(55, 11, 'bv', '7412369855'),
(56, 11, 'Shivam', '9874563211'),
(57, 11, 'xvd', '9874563216'),
(58, 11, 'Shivam', '7412589633');

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

--
-- Table structure for table `dues`
--

CREATE TABLE `dues` (
  `id` int(11) NOT NULL,
  `order_id` int(11) DEFAULT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `mobile` varchar(20) DEFAULT NULL,
  `bill_amount` decimal(10,2) DEFAULT NULL,
  `paid` decimal(10,2) DEFAULT NULL,
  `due` decimal(10,2) DEFAULT NULL,
  `outstanding` decimal(10,2) DEFAULT NULL,
  `leisure` decimal(10,2) DEFAULT NULL,
  `business_id` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `dues`
--

INSERT INTO `dues` (`id`, `order_id`, `customer_name`, `mobile`, `bill_amount`, `paid`, `due`, `outstanding`, `leisure`, `business_id`, `created_at`, `updated_at`) VALUES
(1, NULL, '123', '9874563211', 105.00, 115.00, 0.00, 0.00, 10.00, 11, '2025-12-20 19:22:15', '2025-12-20 14:26:39'),
(2, NULL, '123', '9874563211', 105.00, 105.00, 0.00, 0.00, 0.00, 11, '2025-12-20 19:27:35', NULL),
(3, NULL, '..', '9874563222', 210.00, 210.00, 0.00, 0.00, 0.00, 11, '2025-12-20 19:57:43', '2025-12-20 16:51:00'),
(4, NULL, 'nxbc', '7412589633', 210.00, 210.00, 0.00, 0.00, 0.00, 11, '2025-12-20 23:03:47', '2025-12-20 17:37:04'),
(5, NULL, '12', '9632587411', 210.00, 230.00, 0.00, 0.00, 20.00, 11, '2025-12-20 23:10:07', '2025-12-21 13:11:46'),
(6, NULL, 'bhutiya', '1234567893', 105.00, 35.00, 70.00, 70.00, 0.00, 11, '2025-12-20 23:16:44', '2025-12-21 13:11:34'),
(7, 64, 'joy', '7458963211', 105.00, 105.00, 0.00, 0.00, 0.00, 11, '2025-12-20 23:22:45', '2025-12-20 17:53:10'),
(8, 65, 'bv', '7412369855', 105.00, 105.00, 0.00, 0.00, 0.00, 11, '2025-12-20 23:40:14', '2025-12-20 18:10:38'),
(9, 66, 'Shivam', '9874563211', 210.00, 210.00, 0.00, 0.00, 0.00, 11, '2025-12-21 11:40:44', '2025-12-21 06:11:42'),
(10, NULL, 'Andaman', '7412589633', 210.00, 110.00, 100.00, 100.00, 0.00, 11, '2025-12-21 11:42:19', '2025-12-21 13:12:06'),
(11, 68, 'Shivam', '7412589633', 105.00, 100.00, 5.00, 5.00, 0.00, 11, '2025-12-21 18:49:51', '2025-12-21 13:20:04');

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

--
-- Table structure for table `items`
--

CREATE TABLE `items` (
  `id` int(11) NOT NULL,
  `business_id` int(11) DEFAULT NULL,
  `name` varchar(120) NOT NULL,
  `price` decimal(10,2) NOT NULL DEFAULT 0.00,
  `sku` varchar(40) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `category_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `items`
--

INSERT INTO `items` (`id`, `business_id`, `name`, `price`, `sku`, `is_active`, `category_id`) VALUES
(42, 10, 'veg biriyani', 120.00, '', 1, 17),
(43, 10, 'chicken biriyani', 150.00, '', 1, 17),
(44, 11, 'veg biriyani', 100.00, '', 1, NULL);

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

--
-- Table structure for table `new_items`
--

CREATE TABLE `new_items` (
  `id` int(11) NOT NULL,
  `item_name` varchar(255) DEFAULT NULL,
  `short_name` varchar(100) DEFAULT NULL,
  `hsn_code` varchar(50) DEFAULT NULL,
  `tax_slab` varchar(20) DEFAULT NULL,
  `company` varchar(100) DEFAULT NULL,
  `item_group` varchar(100) DEFAULT NULL,
  `primary_unit` varchar(50) DEFAULT NULL,
  `alternate_unit` varchar(50) DEFAULT NULL,
  `conversion_factor` int(11) DEFAULT NULL,
  `price_per` varchar(50) DEFAULT NULL,
  `purchase_price` decimal(10,2) DEFAULT NULL,
  `sale_price` decimal(10,2) DEFAULT NULL,
  `mrp` decimal(10,2) DEFAULT NULL,
  `opening_qty_kg` decimal(10,2) DEFAULT NULL,
  `opening_qty_gm` decimal(10,2) DEFAULT NULL,
  `img` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `new_items`
--

INSERT INTO `new_items` (`id`, `item_name`, `short_name`, `hsn_code`, `tax_slab`, `company`, `item_group`, `primary_unit`, `alternate_unit`, `conversion_factor`, `price_per`, `purchase_price`, `sale_price`, `mrp`, `opening_qty_kg`, `opening_qty_gm`, `img`, `created_at`) VALUES
(1, 'sugar', '', '', '5% GST', '', '', 'Kgs', 'Gms', 1000, 'Kgs', 55.00, 40.00, 47.00, 1.00, 500.00, '', '2025-12-29 14:24:25'),
(2, 'rice', '', '123', '5% GST', '123', '123', 'Kgs', 'Gms', 1000, 'Kgs', 44.00, 41.00, 50.00, 10.00, 500.00, '', '2025-12-29 14:44:13');

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

--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (
  `id` int(11) NOT NULL,
  `business_id` int(11) NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `table_no` varchar(20) NOT NULL DEFAULT '',
  `status` varchar(15) NOT NULL DEFAULT 'OPEN',
  `subtotal` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `tax` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total` decimal(10,2) NOT NULL DEFAULT 0.00,
  `payment_method` varchar(20) NOT NULL DEFAULT '',
  `gst_enabled` tinyint(1) NOT NULL DEFAULT 1,
  `customer_sno` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `orders`
--

INSERT INTO `orders` (`id`, `business_id`, `created_at`, `table_no`, `status`, `subtotal`, `discount`, `tax`, `total`, `payment_method`, `gst_enabled`, `customer_sno`) VALUES
(55, 10, '2025-10-13 12:57:28', 'Takeaway', 'OPEN', 1770.00, 0.00, 0.00, 1770.00, '', 1, 45),
(56, 10, '2025-10-13 12:58:14', 'Takeaway', 'PAID', 2520.00, 0.00, 0.00, 2520.00, 'CASH', 0, 46),
(57, 11, '2025-12-20 18:50:11', 't6', 'CANCELLED', 200.00, 0.00, 10.00, 210.00, '', 1, 47),
(58, 11, '2025-12-20 19:06:14', '1', 'DUE', 100.00, 0.00, 5.00, 105.00, '', 1, 48),
(59, 11, '2025-12-20 19:22:09', 'f', 'DUE', 100.00, 0.00, 5.00, 105.00, '', 1, 49),
(60, 11, '2025-12-20 19:57:35', '11', 'DUE', 200.00, 0.00, 10.00, 210.00, '', 1, 50),
(61, 11, '2025-12-20 23:03:38', 'Takeaway', 'DUE', 200.00, 0.00, 10.00, 210.00, '', 1, 51),
(62, 11, '2025-12-20 23:10:02', 'Takeaway', 'DUE', 200.00, 0.00, 10.00, 210.00, '', 1, 52),
(63, 11, '2025-12-20 23:16:38', '1', 'DUE', 100.00, 0.00, 5.00, 105.00, '', 1, 53),
(64, 11, '2025-12-20 23:22:41', 't6', 'PAID', 100.00, 0.00, 5.00, 105.00, 'DUE_SETTLEMENT', 1, 54),
(65, 11, '2025-12-20 23:40:07', 'T4', 'PAID', 100.00, 0.00, 5.00, 105.00, 'DUE_SETTLEMENT', 1, 55),
(66, 11, '2025-12-21 11:40:33', 'T10', 'PAID', 200.00, 0.00, 10.00, 210.00, 'DUE_SETTLEMENT', 1, 56),
(67, 11, '2025-12-21 18:40:43', '1', 'PAID', 100.00, 0.00, 5.00, 105.00, 'CARD', 1, 57),
(68, 11, '2025-12-21 18:49:44', 'Takeaway', 'DUE', 100.00, 0.00, 5.00, 105.00, '', 1, 58);

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

--
-- Table structure for table `order_items`
--

CREATE TABLE `order_items` (
  `id` int(11) NOT NULL,
  `business_id` int(11) DEFAULT NULL,
  `order_id` int(11) NOT NULL,
  `item_id` int(11) DEFAULT NULL,
  `item_name` varchar(120) NOT NULL,
  `price` decimal(10,2) NOT NULL DEFAULT 0.00,
  `qty` int(11) NOT NULL DEFAULT 1,
  `notes` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `order_items`
--

INSERT INTO `order_items` (`id`, `business_id`, `order_id`, `item_id`, `item_name`, `price`, `qty`, `notes`) VALUES
(85, 10, 55, 43, 'chicken biriyani', 150.00, 11, NULL),
(86, 10, 55, 42, 'veg biriyani', 120.00, 1, NULL),
(87, 10, 56, 43, 'chicken biriyani', 150.00, 16, NULL),
(88, 10, 56, 42, 'veg biriyani', 120.00, 1, NULL),
(89, 11, 57, 44, 'veg biriyani', 100.00, 1, NULL),
(90, 11, 57, 44, 'veg biriyani', 100.00, 1, NULL),
(91, 11, 58, 44, 'veg biriyani', 100.00, 1, NULL),
(92, 11, 59, 44, 'veg biriyani', 100.00, 1, NULL),
(93, 11, 60, 44, 'veg biriyani', 100.00, 1, NULL),
(94, 11, 60, 44, 'veg biriyani', 100.00, 1, NULL),
(95, 11, 61, 44, 'veg biriyani', 100.00, 1, NULL),
(96, 11, 61, 44, 'veg biriyani', 100.00, 1, NULL),
(98, 11, 62, 44, 'veg biriyani', 100.00, 1, NULL),
(99, 11, 62, 44, 'veg biriyani', 100.00, 1, NULL),
(100, 11, 63, 44, 'veg biriyani', 100.00, 1, NULL),
(101, 11, 64, 44, 'veg biriyani', 100.00, 1, NULL),
(102, 11, 65, 44, 'veg biriyani', 100.00, 1, NULL),
(103, 11, 66, 44, 'veg biriyani', 100.00, 1, NULL),
(104, 11, 66, 44, 'veg biriyani', 100.00, 1, NULL),
(105, 11, 67, 44, 'veg biriyani', 100.00, 1, NULL),
(106, 11, 68, 44, 'veg biriyani', 100.00, 1, NULL);

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

--
-- Table structure for table `payment_requests`
--

CREATE TABLE `payment_requests` (
  `id` int(11) NOT NULL,
  `restaurant_id` int(11) NOT NULL,
  `amount` decimal(10,2) DEFAULT NULL,
  `mode` varchar(50) DEFAULT NULL,
  `transaction_id` varchar(100) DEFAULT NULL,
  `screenshot` varchar(255) DEFAULT NULL,
  `status` enum('pending','approved','rejected') DEFAULT 'pending',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `payment_requests`
--

INSERT INTO `payment_requests` (`id`, `restaurant_id`, `amount`, `mode`, `transaction_id`, `screenshot`, `status`, `created_at`) VALUES
(1, 11, 400.00, 'Bank Transfer', 'dvxvcx', '', 'approved', '2025-12-20 13:18:51');

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

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

CREATE TABLE `settings` (
  `id` int(11) NOT NULL,
  `business_name` varchar(120) NOT NULL DEFAULT 'My Restaurant',
  `address` varchar(255) NOT NULL DEFAULT '123, Main Road, Your City',
  `phone` varchar(30) NOT NULL DEFAULT '+91-90000 00000',
  `gstin` varchar(30) NOT NULL DEFAULT '',
  `gst_rate` decimal(5,2) NOT NULL DEFAULT 5.00,
  `gst_applicable` tinyint(1) NOT NULL DEFAULT 1,
  `password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

INSERT INTO `settings` (`id`, `business_name`, `address`, `phone`, `gstin`, `gst_rate`, `gst_applicable`, `password`) VALUES
(9, 'My Restaurant', '123, Main Road, Your City', '+91-90000 00000', '', 5.00, 1, ''),
(10, 'Guras kitchen', 'Sepco', '9874563211', '', 5.00, 0, '$2y$10$F8iyvqfH2jMeWUqTJ934AuTXjZUo8Pt44apGNHlx71y2TjHC9OvV.'),
(11, 'Lassi king', 'Sepco', '9874563212', '', 5.00, 1, '$2y$10$gxm8vxivmcXx9G/RvuUhresy4rUIHbFWfvWjqBV0pQKLbLRRNvyza'),
(12, 'Home cafe', 'Sepco', '7412589633', '', 5.00, 1, '$2y$10$98O50JiTExLCiq3.YrWWMeQ/5e5iv1FhMcGCexU8pyIx19aSFctdu');

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

--
-- Table structure for table `subscriptions`
--

CREATE TABLE `subscriptions` (
  `id` int(11) NOT NULL,
  `restaurant_id` int(11) NOT NULL,
  `plan` varchar(50) DEFAULT 'monthly',
  `start_date` datetime NOT NULL,
  `expiry_date` datetime NOT NULL,
  `status` enum('active','expired') DEFAULT 'active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `subscriptions`
--

INSERT INTO `subscriptions` (`id`, `restaurant_id`, `plan`, `start_date`, `expiry_date`, `status`) VALUES
(2, 7, 'demo-1hour', '2025-10-12 00:00:00', '2025-10-12 00:00:00', 'active'),
(3, 8, 'demo-1hour', '2025-10-12 00:00:00', '2025-10-12 00:00:00', 'active'),
(4, 9, 'demo-1hour', '2025-10-13 09:04:36', '2025-10-13 10:04:36', 'active'),
(5, 10, 'demo-1hour', '2025-10-13 09:26:12', '2025-10-13 10:26:12', 'active'),
(6, 11, 'demo-1hour', '2025-12-20 18:49:21', '2026-01-20 18:49:21', 'active'),
(7, 12, 'demo-1hour', '2025-10-26 05:15:17', '2025-10-26 06:15:17', 'active');

--
-- Indexes for dumped tables
--

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

--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_business_category` (`business_id`,`name`),
  ADD KEY `idx_categories_business_id` (`business_id`);

--
-- Indexes for table `customer`
--
ALTER TABLE `customer`
  ADD PRIMARY KEY (`sno`),
  ADD KEY `idx_customer_business_id` (`business_id`);

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

--
-- Indexes for table `items`
--
ALTER TABLE `items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_items_category` (`category_id`),
  ADD KEY `idx_items_business_id` (`business_id`);

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

--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_orders_customer` (`customer_sno`),
  ADD KEY `idx_orders_business_id` (`business_id`);

--
-- Indexes for table `order_items`
--
ALTER TABLE `order_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_oi_order` (`order_id`),
  ADD KEY `fk_oi_item` (`item_id`),
  ADD KEY `idx_order_items_business_id` (`business_id`);

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

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

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

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `accounts`
--
ALTER TABLE `accounts`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- AUTO_INCREMENT for table `customer`
--
ALTER TABLE `customer`
  MODIFY `sno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=59;

--
-- AUTO_INCREMENT for table `dues`
--
ALTER TABLE `dues`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `items`
--
ALTER TABLE `items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=45;

--
-- AUTO_INCREMENT for table `new_items`
--
ALTER TABLE `new_items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=69;

--
-- AUTO_INCREMENT for table `order_items`
--
ALTER TABLE `order_items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=107;

--
-- AUTO_INCREMENT for table `payment_requests`
--
ALTER TABLE `payment_requests`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `settings`
--
ALTER TABLE `settings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `subscriptions`
--
ALTER TABLE `subscriptions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `items`
--
ALTER TABLE `items`
  ADD CONSTRAINT `fk_items_category` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `orders`
--
ALTER TABLE `orders`
  ADD CONSTRAINT `fk_orders_customer` FOREIGN KEY (`customer_sno`) REFERENCES `customer` (`sno`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `order_items`
--
ALTER TABLE `order_items`
  ADD CONSTRAINT `fk_oi_item` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_oi_order` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE;
COMMIT;

/*!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 */;
