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

START TRANSACTION;



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

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

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `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()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

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

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

--
-- 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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) 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_users_table', 1),
(2, '0001_01_01_000001_create_cache_table', 1),
(3, '0001_01_01_000002_create_jobs_table', 1),
(4, '2026_03_01_065237_create_transactions_table', 1),
(5, '2026_03_01_065329_create_personal_access_tokens_table', 1),
(6, '2026_03_05_125408_add_avatar_to_users_table', 1);

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

--
-- 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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `transactions`
--

CREATE TABLE `transactions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `sender_id` bigint(20) UNSIGNED DEFAULT NULL,
  `receiver_id` bigint(20) UNSIGNED DEFAULT NULL,
  `type` enum('topup','transfer_in','transfer_out') NOT NULL,
  `amount` bigint(20) UNSIGNED NOT NULL,
  `balance_before` bigint(20) UNSIGNED NOT NULL,
  `balance_after` bigint(20) UNSIGNED NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `reference_id` varchar(255) 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 `transactions`
--

INSERT INTO `transactions` (`id`, `user_id`, `sender_id`, `receiver_id`, `type`, `amount`, `balance_before`, `balance_after`, `description`, `reference_id`, `created_at`, `updated_at`) VALUES
(1, 12, NULL, 12, 'topup', 5000, 0, 5000, 'Top up saldo', '58afefcd-796e-4188-95cf-ffc34f14adcf', '2026-03-05 15:49:01', '2026-03-05 15:49:01'),
(2, 12, NULL, 12, 'topup', 150000, 5000, 155000, 'Top up saldo', 'bf33fb23-9e68-40bd-a5c5-213f6d82596e', '2026-03-05 15:49:21', '2026-03-05 15:49:21'),
(3, 12, 12, 13, 'transfer_out', 45000, 155000, 110000, 'Transfer ke raflierlangga', '2e468460-1945-48ae-a8f8-0b53062160c6-out', '2026-03-05 15:56:06', '2026-03-05 15:56:06'),
(4, 13, 12, 13, 'transfer_in', 45000, 0, 45000, 'Transfer dari erlangga', '2e468460-1945-48ae-a8f8-0b53062160c6-in', '2026-03-05 15:56:06', '2026-03-05 15:56:06'),
(5, 12, 12, 13, 'transfer_out', 50000, 110000, 60000, 'Transfer ke raflierlangga', '802de805-6c14-46de-b4b6-bc68f7895713-out', '2026-03-05 16:19:38', '2026-03-05 16:19:38'),
(6, 13, 12, 13, 'transfer_in', 50000, 45000, 95000, 'Transfer dari erlangga', '802de805-6c14-46de-b4b6-bc68f7895713-in', '2026-03-05 16:19:38', '2026-03-05 16:19:38'),
(7, 13, 13, 12, 'transfer_out', 45000, 95000, 50000, 'Transfer ke erlangga', 'a2949807-faf4-47f6-a3af-797db704988a-out', '2026-03-05 16:21:59', '2026-03-05 16:21:59'),
(8, 12, 13, 12, 'transfer_in', 45000, 60000, 105000, 'Transfer dari raflierlangga', 'a2949807-faf4-47f6-a3af-797db704988a-in', '2026-03-05 16:21:59', '2026-03-05 16:21:59'),
(9, 13, NULL, 13, 'topup', 250000, 50000, 300000, 'Top up saldo', '5afa930b-d1ba-4117-a5b6-0f12e004703e', '2026-03-05 16:27:30', '2026-03-05 16:27:30'),
(10, 13, 13, 14, 'transfer_out', 220000, 300000, 80000, 'Transfer ke dyah23', 'e92a7e2c-3aa3-48fa-9e99-d913166f4e79-out', '2026-03-05 16:28:02', '2026-03-05 16:28:02'),
(11, 14, 13, 14, 'transfer_in', 220000, 0, 220000, 'Transfer dari raflierlangga', 'e92a7e2c-3aa3-48fa-9e99-d913166f4e79-in', '2026-03-05 16:28:02', '2026-03-05 16:28:02'),
(12, 14, 14, 12, 'transfer_out', 20000, 220000, 200000, 'Transfer ke erlangga', '1cf8540a-8d09-4477-a15e-80ed1135a13e-out', '2026-03-05 16:28:36', '2026-03-05 16:28:36'),
(13, 12, 14, 12, 'transfer_in', 20000, 105000, 125000, 'Transfer dari dyah23', '1cf8540a-8d09-4477-a15e-80ed1135a13e-in', '2026-03-05 16:28:36', '2026-03-05 16:28:36');

--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indexes for table `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

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

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

--
-- 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 `transactions`
--
ALTER TABLE `transactions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `transactions_reference_id_unique` (`reference_id`),
  ADD KEY `transactions_sender_id_foreign` (`sender_id`),
  ADD KEY `transactions_receiver_id_foreign` (`receiver_id`),
  ADD KEY `transactions_user_id_index` (`user_id`),
  ADD KEY `transactions_reference_id_index` (`reference_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `transactions`
--
ALTER TABLE `transactions`
  ADD CONSTRAINT `transactions_receiver_id_foreign` FOREIGN KEY (`receiver_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `transactions_sender_id_foreign` FOREIGN KEY (`sender_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `transactions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

