-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Mar 12, 2026 at 06:40 PM
-- Server version: 8.0.33-cll-lve
-- PHP Version: 8.1.16

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: `diginspire_factory`
--

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

--
-- Table structure for table `admins`
--

CREATE TABLE `admins` (
  `id` int NOT NULL,
  `username` varchar(100) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(150) NOT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `admins`
--

INSERT INTO `admins` (`id`, `username`, `password`, `email`, `created_at`) VALUES
(1, 'mainadmin', 'admin', 'admin@sunshineenterprises.com', '2025-07-28 13:03:06');

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

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

CREATE TABLE `categories` (
  `id` int NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `categories` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'Foam Chemicals', '2025-07-29 05:43:41', '2025-07-29 05:43:41'),
(2, 'Rebonded Production Materials', '2025-07-29 05:43:41', '2025-07-29 05:43:41'),
(3, 'Fabric Rolls', '2025-07-29 05:43:41', '2025-07-29 05:43:41'),
(4, 'Grease Chemicals', '2025-07-29 05:43:41', '2025-07-29 05:43:41'),
(5, 'Other', '2025-07-29 05:43:41', '2025-07-29 05:43:41'),
(6, 'Chemicals', '2025-07-29 06:06:05', '2025-07-29 06:06:05'),
(7, 'Fabrics', '2025-07-29 06:06:05', '2025-07-29 06:06:05'),
(8, 'Blades', '2025-07-29 06:06:05', '2025-07-29 06:06:05'),
(9, 'Packaging', '2025-07-29 06:06:05', '2025-07-29 06:06:05'),
(10, 'Adhesives', '2025-07-29 06:06:05', '2025-07-29 06:06:05');

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

--
-- Table structure for table `companies`
--

CREATE TABLE `companies` (
  `id` int NOT NULL,
  `company_name` varchar(150) NOT NULL,
  `username` varchar(100) NOT NULL,
  `email` varchar(150) NOT NULL,
  `password` varchar(255) NOT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `companies`
--

INSERT INTO `companies` (`id`, `company_name`, `username`, `email`, `password`, `created_at`) VALUES
(5, 'McFit Mattress', 'McFit Mattress', 'info@mcfit.com', '123456', '2025-08-05 10:49:03'),
(7, 'Test Company', 'Test Company', 'login@test.com', '123456', '2025-08-06 15:39:42');

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

--
-- Table structure for table `culting_logs`
--

CREATE TABLE `culting_logs` (
  `id` int NOT NULL,
  `material_id` int DEFAULT NULL,
  `input_quantity` float DEFAULT NULL,
  `bundle_dimensions` varchar(100) DEFAULT NULL,
  `remarks` text,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `user_id` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `culting_logs`
--

INSERT INTO `culting_logs` (`id`, `material_id`, `input_quantity`, `bundle_dimensions`, `remarks`, `created_at`, `user_id`) VALUES
(5, 23, 200, '200x100x50 cm', 'This is testing again', '2025-08-02 14:21:16', 1),
(6, 28, 50, '500x100x1', 'Single Qt 1', '2025-08-05 11:06:11', 5),
(7, 29, 50, '500x100x1', 'NA', '2025-08-05 11:08:08', 5),
(8, 28, 50, '500x100x1', 'NA', '2025-08-05 11:10:30', 5),
(9, 29, 50, '500x100x1', 'NA', '2025-08-05 11:10:49', 5);

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

--
-- Table structure for table `database_backups`
--

CREATE TABLE `database_backups` (
  `id` int NOT NULL,
  `user_id` int NOT NULL,
  `filename` varchar(255) NOT NULL,
  `backup_time` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `database_backups`
--

INSERT INTO `database_backups` (`id`, `user_id`, `filename`, `backup_time`) VALUES
(1, 1, 'backup_20250801_094526.sql', '2025-08-01 15:15:26'),
(2, 1, 'backup_20250801_094639.sql', '2025-08-01 15:16:39'),
(3, 1, 'backup_20250801_094702.sql', '2025-08-01 15:17:02'),
(4, 1, 'backup_20250801_100002.sql', '2025-08-01 15:30:02');

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

--
-- Table structure for table `materials`
--

CREATE TABLE `materials` (
  `id` int NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `category_id` int NOT NULL,
  `unit_id` int NOT NULL,
  `type` enum('Blades','Chemical','Scraps','Culting') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `current_stock` int NOT NULL DEFAULT '0',
  `min_level` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `user_id` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `materials`
--

INSERT INTO `materials` (`id`, `name`, `category_id`, `unit_id`, `type`, `current_stock`, `min_level`, `created_at`, `updated_at`, `user_id`) VALUES
(1, 'Foam Chemical A', 1, 1, 'Chemical', 250, 50, '2025-07-29 05:45:50', '2025-07-29 05:45:50', 0),
(2, 'Fabric Roll B', 3, 4, 'Blades', 2, 5, '2025-07-29 05:45:50', '2025-07-29 05:45:50', 0),
(3, 'Grease Chemical X', 4, 2, 'Chemical', 150, 20, '2025-07-29 05:45:50', '2025-07-29 05:45:50', 0),
(4, 'Foam Chemical B', 1, 1, 'Chemical', 100, 30, '2025-07-29 05:45:50', '2025-07-29 05:45:50', 0),
(5, 'Rebonded Chem Y', 2, 2, 'Chemical', 80, 15, '2025-07-29 05:45:50', '2025-07-29 05:45:50', 0),
(6, 'Fabric Roll C', 3, 4, 'Blades', 1, 3, '2025-07-29 05:45:50', '2025-07-29 05:45:50', 0),
(7, 'Grease Chemical Z', 4, 2, 'Chemical', 200, 25, '2025-07-29 05:45:50', '2025-07-29 05:45:50', 0),
(8, 'Foam Chemical C', 1, 1, 'Chemical', 40, 50, '2025-07-29 05:45:50', '2025-07-29 05:45:50', 0),
(9, 'Rebonded Scrap', 2, 1, 'Scraps', 200, 100, '2025-07-29 05:45:50', '2025-07-29 06:28:53', 0),
(10, 'Fabric Roll D', 3, 4, 'Blades', 2, 5, '2025-07-29 05:45:50', '2025-08-01 05:46:37', 1),
(13, 'Cutting Blade Z', 8, 7, 'Blades', 10, 50, '2025-07-29 06:06:05', '2025-08-01 05:45:04', 1),
(21, 'Testing12', 10, 6, 'Blades', 65, 10, '2025-07-31 11:50:58', '2025-08-01 04:54:33', 1),
(22, 'Culting Data 1', 10, 6, 'Culting', 100, 10, '2025-08-01 11:34:28', '2025-08-02 08:50:14', 1),
(23, 'Culting Data 2', 10, 6, 'Culting', 200, 10, '2025-08-01 11:35:48', '2025-08-02 08:51:16', 1),
(24, 'Culting Data 3', 10, 6, 'Culting', 0, 10, '2025-08-01 11:35:58', '2025-08-01 11:35:58', 1),
(25, 'Chemical A', 1, 1, 'Chemical', 0, 10, '2025-08-05 05:20:02', '2025-08-05 05:48:57', 5),
(26, 'Chemical B', 1, 1, 'Chemical', 0, 10, '2025-08-05 05:20:13', '2025-08-05 05:48:57', 5),
(27, 'Chemical C', 1, 1, 'Chemical', 0, 10, '2025-08-05 05:20:25', '2025-08-05 05:48:57', 5),
(28, 'Type A Fabric Bundle', 3, 4, 'Culting', 100, 10, '2025-08-05 05:31:40', '2025-08-05 05:40:30', 5),
(29, 'Type B Fabric Bundle', 3, 3, 'Culting', 100, 10, '2025-08-05 05:32:19', '2025-08-05 05:40:49', 5),
(30, 'Greese Chem 1', 4, 2, 'Chemical', 19, 10, '2025-08-05 05:45:45', '2025-08-05 05:48:12', 5),
(31, 'Greese Chem 2', 4, 2, 'Chemical', 18, 10, '2025-08-05 05:45:48', '2025-08-05 05:48:12', 5),
(33, 'Test', 10, 6, 'Blades', 50, 10, '2025-08-20 10:02:11', '2025-08-20 10:02:53', 7);

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

--
-- Table structure for table `production_materials`
--

CREATE TABLE `production_materials` (
  `id` int NOT NULL,
  `material_id` int NOT NULL,
  `production_type` varchar(100) NOT NULL,
  `user_id` int NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `production_materials`
--

INSERT INTO `production_materials` (`id`, `material_id`, `production_type`, `user_id`, `created_at`) VALUES
(24, 27, 'Foam Production', 5, '2025-08-05 05:29:15'),
(25, 25, 'Foam Production', 5, '2025-08-05 05:29:15'),
(26, 26, 'Foam Production', 5, '2025-08-05 05:29:15'),
(27, 27, 'Rebonded Production', 5, '2025-08-05 05:30:33'),
(28, 25, 'Rebonded Production', 5, '2025-08-05 05:30:33'),
(29, 26, 'Rebonded Production', 5, '2025-08-05 05:30:33'),
(30, 28, 'Culting', 5, '2025-08-05 05:37:18'),
(31, 29, 'Culting', 5, '2025-08-05 05:37:18'),
(32, 31, 'Grease Manufacturing', 5, '2025-08-05 05:47:22'),
(33, 30, 'Grease Manufacturing', 5, '2025-08-05 05:47:22'),
(34, 33, 'Foam Production', 7, '2025-08-20 10:03:02');

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

--
-- Table structure for table `production_usage_logs`
--

CREATE TABLE `production_usage_logs` (
  `id` int NOT NULL,
  `user_id` int DEFAULT NULL,
  `material_name` varchar(255) DEFAULT NULL,
  `quantity_used` float DEFAULT NULL,
  `unit_name` varchar(50) DEFAULT NULL,
  `production_type` varchar(100) DEFAULT NULL,
  `product_qty_generated` float DEFAULT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `production_usage_logs`
--

INSERT INTO `production_usage_logs` (`id`, `user_id`, `material_name`, `quantity_used`, `unit_name`, `production_type`, `product_qty_generated`, `created_at`) VALUES
(1, 1, 'Testing12', 24, 'Gallon', 'Grease Manufacturing', 12, '2025-07-31 18:41:42'),
(2, 1, 'Cutting Blade Z', 10, 'Pcs', 'Foam Production', 10, '2025-07-31 18:48:27'),
(3, 1, 'Testing12', 10, 'Gallon', 'Foam Production', 10, '2025-07-31 18:48:27'),
(4, 1, 'Cutting Blade Z', 1, 'Pcs', 'Foam Production', 5, '2025-08-01 10:24:16'),
(5, 1, 'Testing12', 20, 'Gallon', 'Foam Production', 5, '2025-08-01 10:24:16'),
(6, 1, 'Fabric Roll D', 2, 'Rolls', 'Foam Production', 5, '2025-08-01 10:24:33'),
(7, 1, 'Cutting Blade Z', 1, 'Pcs', 'Foam Production', 5, '2025-08-01 10:24:33'),
(8, 1, 'Testing12', 5, 'Gallon', 'Foam Production', 5, '2025-08-01 10:24:33'),
(9, 5, 'Chemical C', 10, 'Kg', 'Foam Production', 20, '2025-08-05 11:00:48'),
(10, 5, 'Chemical A', 10, 'Kg', 'Foam Production', 20, '2025-08-05 11:00:48'),
(11, 5, 'Chemical B', 10, 'Kg', 'Foam Production', 20, '2025-08-05 11:00:48'),
(12, 5, 'Type A Fabric Bundle', 1, 'Rolls', 'Culting', 20, '2025-08-05 11:07:42'),
(13, 5, 'Type A Fabric Bundle', 20, 'Rolls', 'Culting', 50, '2025-08-05 11:08:26'),
(14, 5, 'Type B Fabric Bundle', 35, 'Meter', 'Culting', 50, '2025-08-05 11:08:26'),
(15, 5, 'Type A Fabric Bundle', 35, 'Rolls', 'Culting', 50, '2025-08-05 11:09:05'),
(16, 5, 'Type B Fabric Bundle', 55, 'Meter', 'Culting', 50, '2025-08-05 11:09:05'),
(17, 5, 'Chemical C', 10, 'Kg', 'Rebonded Production', 50, '2025-08-05 11:17:06'),
(18, 5, 'Chemical A', 10, 'Kg', 'Rebonded Production', 50, '2025-08-05 11:17:06'),
(19, 5, 'Chemical B', 10, 'Kg', 'Rebonded Production', 50, '2025-08-05 11:17:06'),
(20, 5, 'Greese Chem 2', 2, 'Liter', 'Grease Manufacturing', 50, '2025-08-05 11:17:36'),
(21, 5, 'Greese Chem 1', 2, 'Liter', 'Grease Manufacturing', 50, '2025-08-05 11:17:36'),
(22, 5, 'Greese Chem 2', 30, 'Liter', 'Grease Manufacturing', 50, '2025-08-05 11:18:12'),
(23, 5, 'Greese Chem 1', 30, 'Liter', 'Grease Manufacturing', 50, '2025-08-05 11:18:12'),
(24, 5, 'Chemical C', 30, 'Kg', 'Foam Production', 50, '2025-08-05 11:18:57'),
(25, 5, 'Chemical A', 80, 'Kg', 'Foam Production', 50, '2025-08-05 11:18:57'),
(26, 5, 'Chemical B', 30, 'Kg', 'Foam Production', 50, '2025-08-05 11:18:57');

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

--
-- Table structure for table `read_notifications`
--

CREATE TABLE `read_notifications` (
  `id` int NOT NULL,
  `user_id` int NOT NULL,
  `material_id` int NOT NULL,
  `marked_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `read_notifications`
--

INSERT INTO `read_notifications` (`id`, `user_id`, `material_id`, `marked_at`) VALUES
(1, 1, 10, '2025-08-02 14:39:09'),
(2, 1, 13, '2025-08-02 14:39:43'),
(3, 5, 25, '2025-08-05 11:19:02'),
(4, 5, 26, '2025-08-05 11:19:04'),
(5, 5, 27, '2025-08-05 11:19:06');

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

--
-- Table structure for table `stock_entries`
--

CREATE TABLE `stock_entries` (
  `id` int NOT NULL,
  `material_id` int NOT NULL COMMENT 'Foreign key to materials table',
  `supplier_id` int NOT NULL COMMENT 'Foreign key to suppliers table',
  `quantity` int NOT NULL COMMENT 'Quantity of material added in this entry',
  `entry_date` date NOT NULL COMMENT 'Date when the stock was entered',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `user_id` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `stock_entries`
--

INSERT INTO `stock_entries` (`id`, `material_id`, `supplier_id`, `quantity`, `entry_date`, `created_at`, `user_id`) VALUES
(2, 13, 1, 5, '2025-07-29', '2025-07-29 10:17:18', 1),
(3, 21, 2, 12, '2025-07-31', '2025-07-31 11:55:39', 1),
(5, 25, 5, 50, '2025-08-05', '2025-08-05 05:28:22', 5),
(6, 26, 5, 50, '2025-08-05', '2025-08-05 05:28:35', 5),
(7, 25, 5, 50, '2025-08-05', '2025-08-05 05:28:40', 5),
(8, 27, 5, 50, '2025-07-05', '2025-08-05 05:28:54', 5),
(9, 30, 5, 50, '2025-08-05', '2025-08-05 05:46:29', 5),
(10, 31, 5, 50, '2025-08-05', '2025-08-05 05:46:36', 5),
(11, 33, 6, 50, '2025-08-20', '2025-08-20 10:02:53', 7);

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

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

CREATE TABLE `suppliers` (
  `id` int NOT NULL,
  `name` varchar(255) NOT NULL COMMENT 'Name of the supplier',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `user_id` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `suppliers`
--

INSERT INTO `suppliers` (`id`, `name`, `created_at`, `user_id`) VALUES
(1, 'Chemicals Inc.', '2025-07-29 06:06:05', NULL),
(2, 'Fabric Mill Co.', '2025-07-29 06:06:05', NULL),
(3, 'Industrial Supplies Ltd.', '2025-07-29 06:06:05', NULL),
(5, 'Test Supplier', '2025-08-05 05:24:31', 5),
(6, 'Abcd', '2025-08-20 10:02:38', 7);

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

--
-- Table structure for table `units`
--

CREATE TABLE `units` (
  `id` int NOT NULL,
  `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `units`
--

INSERT INTO `units` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'Kg', '2025-07-29 05:44:08', '2025-07-29 05:44:08'),
(2, 'Liter', '2025-07-29 05:44:08', '2025-07-29 05:44:08'),
(3, 'Meter', '2025-07-29 05:44:08', '2025-07-29 05:44:08'),
(4, 'Rolls', '2025-07-29 05:44:08', '2025-07-29 05:44:08'),
(5, 'Pieces', '2025-07-29 05:44:08', '2025-07-29 05:44:08'),
(6, 'Gallon', '2025-07-29 05:44:08', '2025-07-29 05:44:08'),
(7, 'Pcs', '2025-07-29 06:06:05', '2025-07-29 06:06:05'),
(13, 'mm', '2025-08-05 05:43:30', '2025-08-05 05:43:30');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`),
  ADD UNIQUE KEY `email` (`email`);

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

--
-- Indexes for table `companies`
--
ALTER TABLE `companies`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`),
  ADD UNIQUE KEY `email` (`email`);

--
-- Indexes for table `culting_logs`
--
ALTER TABLE `culting_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `material_id` (`material_id`);

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

--
-- Indexes for table `materials`
--
ALTER TABLE `materials`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`),
  ADD KEY `category_id` (`category_id`),
  ADD KEY `unit_id` (`unit_id`);

--
-- Indexes for table `production_materials`
--
ALTER TABLE `production_materials`
  ADD PRIMARY KEY (`id`),
  ADD KEY `material_id` (`material_id`),
  ADD KEY `user_id` (`user_id`);

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

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

--
-- Indexes for table `stock_entries`
--
ALTER TABLE `stock_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `material_id` (`material_id`),
  ADD KEY `supplier_id` (`supplier_id`);

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `companies`
--
ALTER TABLE `companies`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `culting_logs`
--
ALTER TABLE `culting_logs`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `database_backups`
--
ALTER TABLE `database_backups`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `materials`
--
ALTER TABLE `materials`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;

--
-- AUTO_INCREMENT for table `production_materials`
--
ALTER TABLE `production_materials`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;

--
-- AUTO_INCREMENT for table `production_usage_logs`
--
ALTER TABLE `production_usage_logs`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;

--
-- AUTO_INCREMENT for table `read_notifications`
--
ALTER TABLE `read_notifications`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `stock_entries`
--
ALTER TABLE `stock_entries`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `suppliers`
--
ALTER TABLE `suppliers`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `units`
--
ALTER TABLE `units`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `culting_logs`
--
ALTER TABLE `culting_logs`
  ADD CONSTRAINT `culting_logs_ibfk_1` FOREIGN KEY (`material_id`) REFERENCES `materials` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `materials`
--
ALTER TABLE `materials`
  ADD CONSTRAINT `materials_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  ADD CONSTRAINT `materials_ibfk_2` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

--
-- Constraints for table `production_materials`
--
ALTER TABLE `production_materials`
  ADD CONSTRAINT `production_materials_ibfk_1` FOREIGN KEY (`material_id`) REFERENCES `materials` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `production_materials_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_entries`
--
ALTER TABLE `stock_entries`
  ADD CONSTRAINT `stock_entries_ibfk_1` FOREIGN KEY (`material_id`) REFERENCES `materials` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `stock_entries_ibfk_2` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`) ON DELETE RESTRICT ON UPDATE 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 */;
