-- https://www.phpmyadmin.net/
--
-- Waktu pembuatan: 05 Jun 2025 pada 13.03
-- Versi server: 10.4.32-MariaDB
-- Versi PHP: 8.1.25

START TRANSACTION;



--
-- Database: `db_toko_griyo`
--

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

--
-- Struktur dari tabel `bon`
--

CREATE TABLE `bon` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `nama_produk` varchar(255) NOT NULL,
  `nama` varchar(255) NOT NULL,
  `no_ktp` varchar(100) NOT NULL,
  `domisili` varchar(255) NOT NULL,
  `alamat` text NOT NULL,
  `blok` varchar(100) NOT NULL,
  `qty` int(11) DEFAULT NULL,
  `jumlah` int(11) NOT NULL,
  `keterangan` text DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data untuk tabel `bon`
--

INSERT INTO `bon` (`id`, `user_id`, `nama_produk`, `nama`, `no_ktp`, `domisili`, `alamat`, `blok`, `qty`, `jumlah`, `keterangan`, `created_at`, `updated_at`) VALUES
(6, 19, 'Pulpen 0.5mm', 'Riski', '2354670988676', 'Tembelang', 'Jombang', 'RT. 01 / RW. 01', 28, 42000, NULL, '2025-04-29 09:59:54', '2025-04-30 08:03:38'),
(11, 20, 'ESDTJYGKH', 'Yanto', '347687896587', 'Mojokrapak', 'Jombang', 'RT. 01 / RW. 02', 3, 900000, NULL, '2025-04-30 08:06:33', '2025-04-30 08:06:33'),
(12, 19, 'CASH', 'Riski', '2354670988676', 'Tembelang', 'Jombang', 'RT. 01 / RW. 01', NULL, 100000, NULL, '2025-04-30 09:03:59', '2025-06-02 13:44:23'),
(13, 19, 'Beras Premium', 'Ahmad Fauzi', '3276010101010001', 'Bandung', 'Jl. Anggrek No.12', 'A1', 2, 50000, 'Bayar minggu depan', '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(14, 19, 'Minyak Goreng', 'Rina Marlina', '3276010101010002', 'Bandung', 'Jl. Melati No.8', 'B2', 1, 30000, NULL, '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(15, 19, 'CASH', 'Deni Saputra', '3276010101010003', 'Cimahi', 'Jl. Mawar No.5', 'C3', NULL, 45000, '', '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(16, 19, 'CASH', 'Sari Wulandari', '3276010101010004', 'Lembang', 'Jl. Dahlia No.11', 'D4', NULL, 80000, 'Cicil 2x', '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(17, 19, 'Sabun Mandi', 'Andi Pratama', '3276010101010005', 'Garut', 'Jl. Kenanga No.6', 'E5', 4, 100000, NULL, '2025-04-30 16:28:23', '2025-06-02 13:45:17'),
(18, 19, 'Mie Instan', 'Rudi Hartono', '3276010101010006', 'Sumedang', 'Jl. Teratai No.9', 'F6', 10, 25000, 'Cash minggu depan', '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(19, 19, 'Kopi Sachet', 'Lisa Rahmawati', '3276010101010007', 'Bandung', 'Jl. Soka No.3', 'G7', 5, 35000, NULL, '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(20, 19, 'Air Mineral', 'Yudi Santosa', '3276010101010008', 'Cileunyi', 'Jl. Angsana No.7', 'H8', 2, 12000, NULL, '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(21, 19, 'CASH', 'Tina Kusuma', '3276010101010009', 'Cibiru', 'Jl. Palem No.13', 'I9', NULL, 23000, NULL, '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(22, 19, 'CASH', 'Bayu Hermawan', '3276010101010010', 'Cicalengka', 'Jl. Pinus No.10', 'J10', NULL, 18000, NULL, '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(23, 19, 'CASH', 'Wulan Sari', '3276010101010011', 'Bandung', 'Jl. Kamboja No.5', 'K11', NULL, 30000, 'Cash', '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(24, 19, 'CASH', 'Fajar Ramadhan', '3276010101010012', 'Garut', 'Jl. Cemara No.2', 'L12', NULL, 20000, NULL, '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(25, 19, 'Beras Medium', 'Ika Nurlela', '3276010101010013', 'Cimahi', 'Jl. Cendana No.1', 'M13', 2, 45000, '', '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(26, 19, 'Garam Dapur', 'Anton Wibowo', '3276010101010014', 'Bandung', 'Jl. Salam No.4', 'N14', 1, 5000, NULL, '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(27, 19, 'CASH', 'Siti Aminah', '3276010101010015', 'Lembang', 'Jl. Beringin No.6', 'O15', NULL, 15000, 'Bayar hari Jumat', '2025-04-30 16:28:23', '2025-04-30 16:28:23'),
(31, 19, 'CASH', 'Ahmad Fauzi', '3276010101010001', 'Bandung', 'Jl. Anggrek No.12', 'A1', NULL, 100000, NULL, '2025-06-02 13:44:45', '2025-06-02 13:44:45');

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

--
-- Struktur dari tabel `produk`
--

CREATE TABLE `produk` (
  `id` int(11) UNSIGNED NOT NULL,
  `nama` varchar(255) NOT NULL,
  `harga` decimal(10,2) NOT NULL,
  `harga_beli` decimal(10,2) NOT NULL,
  `deskripsi` text NOT NULL,
  `kategori` varchar(100) NOT NULL,
  `stok` int(11) NOT NULL,
  `terjual` int(11) NOT NULL,
  `gambar` varchar(255) DEFAULT NULL,
  `tanggal_ditambahkan` timestamp NOT NULL DEFAULT current_timestamp(),
  `status` enum('aktif','tidak aktif') DEFAULT 'aktif',
  `store_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data untuk tabel `produk`
--

INSERT INTO `produk` (`id`, `nama`, `harga`, `harga_beli`, `deskripsi`, `kategori`, `stok`, `terjual`, `gambar`, `tanggal_ditambahkan`, `status`, `store_id`) VALUES
(2, 'Pulpen 0.5mm', 1500.00, 1000.00, 'Pulpen warna biru dengan tinta halus', 'Alat Tulis', 94, 3, 'cc3c5dcf-58a6-4c3a-a7b7-a9d968040a90.jpg', '2025-04-07 18:50:50', 'aktif', 4),
(3, 'Gelang Kayu', 25000.00, 22000.00, 'Gelang kayu dengan desain etnik', 'Aksesoris', 154, 2, '30a9a2c8-d37d-487d-bdd1-eb044e6d336a.jpg', '2025-04-07 19:28:22', 'aktif', 4),
(4, 'ESDTJYGKH', 300000.00, 250000.00, 'TUTYJGMJ', 'Alat Tulis', 10, 2, '4610468f-2486-42b1-843c-db2105f8851f.jpg', '2025-04-09 09:51:37', 'aktif', 8),
(5, 'Roti Bolu', 2000.00, 1500.00, 'Roti bolu lumer enak', 'Makanan', 50, 0, 'bfea66e9-7fe9-4444-b2df-10bdea87c489.jpg', '2025-06-02 13:18:06', 'aktif', 4);

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

--
-- Struktur dari tabel `riwayat`
--

CREATE TABLE `riwayat` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `nama` varchar(255) NOT NULL,
  `no_ktp` varchar(50) NOT NULL,
  `domisili` varchar(100) NOT NULL,
  `alamat` text NOT NULL,
  `blok` varchar(50) NOT NULL,
  `jumlah` decimal(15,2) NOT NULL,
  `keterangan` varchar(255) DEFAULT NULL,
  `type` enum('tabungan','hutang') NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data untuk tabel `riwayat`
--

INSERT INTO `riwayat` (`id`, `user_id`, `nama`, `no_ktp`, `domisili`, `alamat`, `blok`, `jumlah`, `keterangan`, `type`, `created_at`, `updated_at`) VALUES
(1, 19, 'Riski', '347687896587', 'Tembelang', 'Jombang', 'RT. 01 / RW. 01', 100000.00, 'Penarikan tabungan', 'tabungan', '2025-04-29 01:25:36', '2025-04-29 01:25:36'),
(2, 19, 'Admin', '2546586765789', 'Sentul', 'Jombang', 'RT. 01 / RW. 01', 100000.00, 'Penarikan tabungan', 'tabungan', '2025-04-29 01:26:43', '2025-04-29 01:26:43'),
(6, 19, 'Riski', '2354670988676', 'Tembelang', 'Jombang', 'RT. 01 / RW. 01', 150000.00, 'Pembayaran bon', 'hutang', '2025-04-30 02:02:48', '2025-04-30 02:02:48'),
(7, 19, 'Riski', '2354670988676', 'Tembelang', 'Jombang', 'RT. 01 / RW. 01', 500000.00, 'Pembayaran bon', 'hutang', '2025-04-30 02:06:58', '2025-04-30 02:06:58'),
(8, 1, 'Rina Marlina', '3276010101010002', 'Bandung', 'Jl. Melati No.8', 'B2', 100000.00, 'Tabungan Masuk', 'tabungan', '2025-06-01 22:29:13', '2025-06-01 22:29:13'),
(9, 1, 'Deni Saputra', '3276010101010003', 'Cimahi', 'Jl. Mawar No.5', 'C3', 100000.00, 'Tabungan Masuk', 'tabungan', '2025-06-01 22:37:42', '2025-06-01 22:37:42'),
(10, 1, 'Sinta Herawan', '078697856497690', 'Cimahi', 'Jombang', 'RT. 01 / RW. 01', 100000.00, 'Tabungan Masuk', 'tabungan', '2025-06-01 22:39:00', '2025-06-01 22:39:00'),
(11, 19, 'Andi Pratama', '3276010101010005', 'Garut', 'Jl. Kenanga No.6', 'E5', 100000.00, 'Tabungan Masuk', 'tabungan', '2025-06-01 22:49:25', '2025-06-01 22:49:25'),
(12, 22, 'Riski Iswahyudi', '43456798786767', 'Mojokrapak', 'Jombang', 'RT. 01 / RW. 01', 100000.00, 'Penambahan tabungan', 'tabungan', '2025-06-02 05:49:58', '2025-06-02 05:49:58'),
(13, 19, 'Riski', '2354670988676', 'Tembelang', 'Jombang', 'RT. 01 / RW. 01', 100000.00, 'Input bon baru', 'hutang', '2025-06-02 06:44:23', '2025-06-02 06:44:23'),
(14, 19, 'Ahmad Fauzi', '3276010101010001', 'Bandung', 'Jl. Anggrek No.12', 'A1', 100000.00, 'Input bon baru', 'hutang', '2025-06-02 06:44:45', '2025-06-02 06:44:45'),
(15, 19, 'Andi Pratama', '3276010101010005', 'Garut', 'Jl. Kenanga No.6', 'E5', 40000.00, 'Pembayaran bon', 'hutang', '2025-06-02 06:45:17', '2025-06-02 06:45:17'),
(16, 19, 'Riski Hidayat', '347687896587', 'Tembelang', 'Jombang', 'RT. 01 / RW. 01', 100000.00, 'Penambahan tabungan', 'tabungan', '2025-06-02 06:49:36', '2025-06-02 06:49:36');

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

--
-- Struktur dari tabel `stores`
--

CREATE TABLE `stores` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `nama` varchar(100) NOT NULL,
  `address` text NOT NULL,
  `phone` varchar(15) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `privasi` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data untuk tabel `stores`
--

INSERT INTO `stores` (`id`, `user_id`, `nama`, `address`, `phone`, `created_at`, `updated_at`, `privasi`) VALUES
(4, 1, 'Maskyy Cab', 'Kec. Ngusikan', '085850236959', '2025-04-03 06:14:34', '2025-06-02 09:11:40', '[]'),
(6, 1, 'Maskyy Cab 2', 'Kec. Kudu', '0858502367689', '2025-04-05 04:37:37', '2025-04-05 04:37:37', NULL),
(8, 1, 'Maskyy Cab 3', 'Kec. Ploso', '0858502367689', '2025-04-05 04:38:56', '2025-06-02 09:11:54', NULL),
(9, 21, 'Isman', 'Perak', '085850236959', '2025-06-01 23:40:31', '2025-06-01 23:40:31', NULL);

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

--
-- Struktur dari tabel `tabungan`
--

CREATE TABLE `tabungan` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `nama` varchar(255) NOT NULL,
  `no_ktp` varchar(50) NOT NULL,
  `domisili` varchar(100) NOT NULL,
  `alamat` text NOT NULL,
  `blok` varchar(50) NOT NULL,
  `jumlah` decimal(15,2) NOT NULL,
  `keterangan` varchar(255) DEFAULT 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_general_ci;

--
-- Dumping data untuk tabel `tabungan`
--

INSERT INTO `tabungan` (`id`, `user_id`, `nama`, `no_ktp`, `domisili`, `alamat`, `blok`, `jumlah`, `keterangan`, `created_at`, `updated_at`) VALUES
(1, 19, 'Riski', '347687896587', 'Tembelang', 'Jombang', 'RT. 01 / RW. 01', 1800000.00, 'tAbungan', '2025-04-25 00:57:11', '2025-04-29 01:25:36'),
(2, 19, 'Dika', '23546709886i76', 'Mojokrapak', 'Jombang', 'RT. 01 / RW. 01', 1900000.00, 'Tabungan', '2025-04-25 01:20:20', '2025-04-28 23:28:18'),
(3, 19, 'Admin', '2546586765789', 'Sentul', 'Jombang', 'RT. 01 / RW. 01', 2200000.00, 'dtuygkhhfjhmjhoilgkfddffhjkljlukytdgfhgjhyutydyjknbncdytuyiyui;jk.mn,bmvn', '2025-04-25 01:22:28', '2025-04-29 01:26:43'),
(8, 19, 'Riski Hidayat', '347687896587', 'Tembelang', 'Jombang', 'RT. 01 / RW. 01', 800000.00, 'Data awal', '2025-04-29 07:27:51', '2025-06-02 06:49:36'),
(9, 19, 'Siti Aminah', '347687896588', 'Ploso', 'Jombang', 'RT. 02 / RW. 01', 150000.00, NULL, '2025-04-29 07:27:51', '2025-04-29 07:32:00'),
(10, 19, 'Ahmad Fauzi', '347687896589', 'Peterongan', 'Jombang', 'RT. 03 / RW. 01', 0.00, 'Tidak aktif', '2025-04-29 07:27:51', '2025-04-29 07:32:06'),
(11, 19, 'Nur Aini', '347687896590', 'Diwek', 'Jombang', 'RT. 04 / RW. 02', 850000.00, NULL, '2025-04-29 07:27:51', '2025-04-29 07:32:14'),
(12, 19, 'Bayu Setiawan', '347687896591', 'Bandarkedungmulyo', 'Jombang', 'RT. 05 / RW. 03', 300000.00, NULL, '2025-04-29 07:27:51', '2025-04-29 07:32:18'),
(13, 19, 'Rina Kartika', '347687896592', 'Megaluh', 'Jombang', 'RT. 06 / RW. 03', 0.00, 'Saldo kosong', '2025-04-29 07:27:51', '2025-04-29 07:32:23'),
(14, 1, 'Agus Salim', '347687896593', 'Jogoroto', 'Jombang', 'RT. 07 / RW. 04', 900000.00, NULL, '2025-04-29 07:27:51', '2025-04-29 07:27:51'),
(15, 19, 'Nina Lestari', '347687896594', 'Tembelang', 'Jombang', 'RT. 08 / RW. 02', 450000.00, NULL, '2025-04-29 07:27:51', '2025-04-29 07:33:32'),
(16, 19, 'M. Fadli', '347687896595', 'Ploso', 'Jombang', 'RT. 09 / RW. 05', 120000.00, NULL, '2025-04-29 07:27:51', '2025-04-29 07:33:32'),
(17, 19, 'Lisa Amalia', '347687896596', 'Jombang Kota', 'Jombang', 'RT. 10 / RW. 06', 200000.00, NULL, '2025-04-29 07:27:51', '2025-04-29 07:33:32'),
(18, 19, 'Dwi Cahyono', '347687896597', 'Diwek', 'Jombang', 'RT. 11 / RW. 07', 0.00, 'Tidak aktif', '2025-04-29 07:27:51', '2025-04-29 07:33:32'),
(19, 19, 'Intan Permata', '347687896598', 'Sumobito', 'Jombang', 'RT. 12 / RW. 08', 1000000.00, NULL, '2025-04-29 07:27:51', '2025-04-29 07:33:32'),
(20, 19, 'Rafli Andika', '347687896599', 'Ngoro', 'Jombang', 'RT. 13 / RW. 09', 800000.00, NULL, '2025-04-29 07:27:51', '2025-04-29 07:33:32'),
(21, 19, 'Ayu Wulandari', '347687896600', 'Mojowarno', 'Jombang', 'RT. 14 / RW. 10', 0.00, 'Tidak ada saldo', '2025-04-29 07:27:51', '2025-04-29 07:33:32'),
(22, 19, 'Dedi Susanto', '347687896601', 'Gudo', 'Jombang', 'RT. 15 / RW. 11', 550000.00, NULL, '2025-04-29 07:27:51', '2025-04-29 07:33:32'),
(23, 19, 'Fajar Nugroho', '347687896602', 'Kesamben', 'Jombang', 'RT. 16 / RW. 12', 250000.00, NULL, '2025-04-29 07:27:51', '2025-04-29 07:33:32'),
(24, 22, 'Riski Iswahyudi', '43456798786767', 'Mojokrapak', 'Jombang', 'RT. 01 / RW. 01', 200000.00, NULL, '2025-06-02 05:15:49', '2025-06-02 05:49:58'),
(26, 22, 'Rianti', '3546576788765', 'Tembelang', 'Jombang', 'RT. 01 / RW. 01', 100000.00, NULL, '2025-06-02 05:36:31', '2025-06-02 05:36:31');

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

--
-- Struktur dari tabel `tagihan`
--

CREATE TABLE `tagihan` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `store_id` bigint(20) UNSIGNED NOT NULL,
  `total_tagihan` decimal(12,2) NOT NULL,
  `status` enum('belum lunas','lunas') DEFAULT 'belum lunas',
  `tanggal_tagihan` date NOT NULL,
  `keterangan` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data untuk tabel `tagihan`
--

INSERT INTO `tagihan` (`id`, `store_id`, `total_tagihan`, `status`, `tanggal_tagihan`, `keterangan`, `created_at`, `updated_at`) VALUES
(1, 4, 100000.00, 'lunas', '2025-06-04', 'PDAM', '2025-06-03 20:07:54', '2025-06-04 09:18:51'),
(2, 1, 100000.00, 'belum lunas', '2025-06-04', 'Listrik', '2025-06-03 20:09:17', '2025-06-03 20:09:17'),
(3, 4, 18000.00, 'lunas', '2025-06-04', 'Listrik', '2025-06-03 20:23:13', '2025-06-03 20:32:05'),
(4, 4, 20000.00, 'lunas', '2025-05-31', 'Listrik', '2025-06-04 09:18:40', '2025-06-04 11:51:31'),
(5, 4, 12000.00, 'belum lunas', '2025-06-05', 'PDAM', '2025-06-04 11:50:59', '2025-06-04 11:50:59'),
(6, 4, 20000.00, 'belum lunas', '2025-06-05', 'PDAM', '2025-06-04 11:52:11', '2025-06-04 11:52:11');

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

--
-- Struktur dari tabel `terjual`
--

CREATE TABLE `terjual` (
  `id` int(11) UNSIGNED NOT NULL,
  `nama` varchar(255) NOT NULL,
  `harga` decimal(10,2) NOT NULL,
  `harga_beli` decimal(10,2) NOT NULL,
  `deskripsi` text NOT NULL,
  `kategori` varchar(100) NOT NULL,
  `terjual` int(11) NOT NULL,
  `gambar` varchar(255) DEFAULT NULL,
  `tanggal_ditambahkan` timestamp NOT NULL DEFAULT current_timestamp(),
  `store_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data untuk tabel `terjual`
--

INSERT INTO `terjual` (`id`, `nama`, `harga`, `harga_beli`, `deskripsi`, `kategori`, `terjual`, `gambar`, `tanggal_ditambahkan`, `store_id`) VALUES
(1, 'Pulpen 0.5mm', 1500.00, 1000.00, 'Pulpen warna biru dengan tinta halus', 'Alat Tulis', 1, 'cc3c5dcf-58a6-4c3a-a7b7-a9d968040a90.jpg', '2025-04-07 19:23:58', 4),
(2, 'Pulpen 0.5mm', 1500.00, 1000.00, 'Pulpen warna biru dengan tinta halus', 'Alat Tulis', 1, 'cc3c5dcf-58a6-4c3a-a7b7-a9d968040a90.jpg', '2025-04-07 19:25:16', 4),
(3, 'Gelang Kayu', 25000.00, 22000.00, 'Gelang kayu dengan desain etnik', 'Aksesoris', 2, '30a9a2c8-d37d-487d-bdd1-eb044e6d336a.jpg', '2025-04-09 07:27:02', 4),
(4, 'ESDTJYGKH', 300000.00, 250000.00, 'TUTYJGMJ', 'Alat Tulis', 2, '4610468f-2486-42b1-843c-db2105f8851f.jpg', '2025-04-09 09:51:58', 8);

--
-- Indexes for dumped tables
--

--
-- Indeks untuk tabel `bon`
--
ALTER TABLE `bon`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indeks untuk tabel `produk`
--
ALTER TABLE `produk`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_store_id` (`store_id`);

--
-- Indeks untuk tabel `riwayat`
--
ALTER TABLE `riwayat`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indeks untuk tabel `stores`
--
ALTER TABLE `stores`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indeks untuk tabel `tabungan`
--
ALTER TABLE `tabungan`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indeks untuk tabel `tagihan`
--
ALTER TABLE `tagihan`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`store_id`);

--
-- Indeks untuk tabel `terjual`
--
ALTER TABLE `terjual`
  ADD PRIMARY KEY (`id`),
  ADD KEY `store_id` (`store_id`);

--
-- AUTO_INCREMENT untuk tabel yang dibuang
--

--
-- AUTO_INCREMENT untuk tabel `bon`
--
ALTER TABLE `bon`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;

--
-- AUTO_INCREMENT untuk tabel `produk`
--
ALTER TABLE `produk`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT untuk tabel `riwayat`
--
ALTER TABLE `riwayat`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT untuk tabel `stores`
--
ALTER TABLE `stores`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT untuk tabel `tabungan`
--
ALTER TABLE `tabungan`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;

--
-- AUTO_INCREMENT untuk tabel `tagihan`
--
ALTER TABLE `tagihan`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT untuk tabel `terjual`
--
ALTER TABLE `terjual`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables)
--

--
-- Ketidakleluasaan untuk tabel `bon`
--
ALTER TABLE `bon`
  ADD CONSTRAINT `bon_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `produk`
--
ALTER TABLE `produk`
  ADD CONSTRAINT `fk_store_id` FOREIGN KEY (`store_id`) REFERENCES `users` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Ketidakleluasaan untuk tabel `stores`
--
ALTER TABLE `stores`
  ADD CONSTRAINT `stores_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `tabungan`
--
ALTER TABLE `tabungan`
  ADD CONSTRAINT `tabungan_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `terjual`
--
ALTER TABLE `terjual`
  ADD CONSTRAINT `fk_terjual_produk` FOREIGN KEY (`store_id`) REFERENCES `produk` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

