--
-- Host: 127.0.0.1    Database: cgk_stock
-- ------------------------------------------------------

set autocommit=0;
commit;
set autocommit=0;
commit;

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

CREATE TABLE `failed_jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `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(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

set autocommit=0;
commit;

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

CREATE TABLE `items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `ttb_id` bigint(20) unsigned NOT NULL,
  `barcode` char(8) NOT NULL,
  `unit` varchar(10) NOT NULL,
  `brutto_in` decimal(10,2) DEFAULT NULL,
  `tarra` decimal(10,2) DEFAULT NULL,
  `brutto_out` decimal(10,2) DEFAULT NULL,
  `exit_date` timestamp NULL DEFAULT NULL,
  `status` enum('BELUM DITIMBANG','TERSEDIA','TERPAKAI') NOT NULL DEFAULT 'BELUM DITIMBANG',
  `notes` text DEFAULT NULL,
  `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,
  PRIMARY KEY (`id`),
  UNIQUE KEY `items_barcode_unique` (`barcode`),
  KEY `items_created_by_foreign` (`created_by`),
  KEY `items_updated_by_foreign` (`updated_by`),
  KEY `items_status_index` (`status`),
  KEY `items_ttb_id_foreign` (`ttb_id`),
  CONSTRAINT `items_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `items_ttb_id_foreign` FOREIGN KEY (`ttb_id`) REFERENCES `ttbs` (`id`) ON DELETE CASCADE,
  CONSTRAINT `items_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

set autocommit=0;
commit;

--
-- 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,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `job_batches`
--

set autocommit=0;
commit;

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

CREATE TABLE `jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `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,
  PRIMARY KEY (`id`),
  KEY `jobs_queue_index` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `jobs`
--

set autocommit=0;
commit;

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

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

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

set autocommit=0;
INSERT INTO `migrations` VALUES
(9,'0001_01_01_000000_create_users_table',1),
(10,'0001_01_01_000001_create_cache_table',1),
(11,'0001_01_01_000002_create_jobs_table',1),
(12,'2026_01_13_161813_create_items_table',1),
(13,'2026_01_13_212839_rename_phone_number_to_username_in_users_table',2),
(14,'2026_01_15_141600_normalize_items_with_ttbs',3);
commit;
set autocommit=0;
commit;

--
-- 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,
  PRIMARY KEY (`id`),
  KEY `sessions_user_id_index` (`user_id`),
  KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

set autocommit=0;
INSERT INTO `sessions` VALUES
('V7y8x1117kWGQAE3X4zAqSUWeyrhV9p4INlZvE3l',3,'127.0.0.1','Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiU2pBdEhrUzNjR2VFZ1JYNDFYdmJiVUp1U09XNkZwekFtRmlTMXpmVyI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzY6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9hZG1pbi9kYXRhYmFzZSI7czo1OiJyb3V0ZSI7czoxNDoiZGF0YWJhc2UuaW5kZXgiO31zOjUwOiJsb2dpbl93ZWJfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI7aTozO30=',1768462773),
('w97sHgEkWonMW8gmuAV4cNYvws7revIQerz6A0mn',1,'127.0.0.1','Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiTE9KSUNGenpGRVBBeHBqVkljUllCNlUwWjdJeExqaU96RHBhS3VqUSI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6Nzg6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9yZXBvcnRzL2luYm91bmQtdHRiP3ByaW50PXRydWUmc3VwcGxpZXI9JnR0Yj0md2FyZWhvdXNlPSI7czo1OiJyb3V0ZSI7czoxOToicmVwb3J0cy5pbmJvdW5kX3R0YiI7fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjE7fQ==',1768458119);
commit;

--
-- Table structure for table `ttbs`
--

CREATE TABLE `ttbs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `ttb_number` varchar(50) NOT NULL,
  `entry_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `no_pol` varchar(20) NOT NULL,
  `supplier` varchar(100) NOT NULL,
  `item_name` varchar(100) NOT NULL DEFAULT 'Cengkeh',
  `warehouse` varchar(50) NOT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ttbs_ttb_number_unique` (`ttb_number`),
  KEY `ttbs_created_by_foreign` (`created_by`),
  CONSTRAINT `ttbs_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ttbs`
--

set autocommit=0;
commit;
set autocommit=0;
commit;


