-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 05, 2025 at 11:00 AM
-- 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: `amerikan bank`
--

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

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

CREATE TABLE `accounts` (
  `account_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `account_type` enum('Checking','Savings') NOT NULL,
  `account_number` varchar(20) NOT NULL,
  `balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `is_activated` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `accounts` (`account_id`, `user_id`, `account_type`, `account_number`, `balance`, `is_activated`, `created_at`) VALUES
(1, 1, 'Checking', '1234567890', 0.00, 1, '2025-11-04 12:09:08'),
(2, 2, 'Savings', '7304922438', 600.00, 1, '2025-11-04 12:09:36'),
(3, 3, 'Savings', '7376963333', 0.00, 1, '2025-11-04 13:14:03'),
(4, 4, 'Savings', '5622540531', 0.00, 1, '2025-11-04 13:42:01');

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

--
-- Table structure for table `atm_cards`
--

CREATE TABLE `atm_cards` (
  `card_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `cardholder_name` varchar(100) NOT NULL,
  `card_number` varchar(16) NOT NULL,
  `expiry_date` varchar(5) NOT NULL,
  `cvv` varchar(3) NOT NULL,
  `card_type` enum('Debit','Credit','Prepaid') NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `atm_cards`
--

INSERT INTO `atm_cards` (`card_id`, `user_id`, `cardholder_name`, `card_number`, `expiry_date`, `cvv`, `card_type`, `created_at`) VALUES
(1, 2, 'CHIDIEBERE EXECUTIVE', '4484446226679695', '11/28', '460', 'Debit', '2025-11-04 12:37:32');

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

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

CREATE TABLE `transactions` (
  `transaction_id` int(10) UNSIGNED NOT NULL,
  `account_id` int(10) UNSIGNED NOT NULL,
  `type` enum('Deposit','Withdrawal','Transfer','TRANSFER_OUT') NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `narration` varchar(255) DEFAULT NULL,
  `beneficiary_bank` varchar(100) DEFAULT NULL,
  `beneficiary_name` varchar(100) DEFAULT NULL,
  `beneficiary_account` varchar(20) DEFAULT NULL,
  `status` enum('PENDING','COMPLETED','FAILED') DEFAULT 'PENDING',
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `transactions`
--

INSERT INTO `transactions` (`transaction_id`, `account_id`, `type`, `amount`, `description`, `narration`, `beneficiary_bank`, `beneficiary_name`, `beneficiary_account`, `status`, `created_at`) VALUES
(1, 2, 'Deposit', 1000.00, NULL, 'Balance', NULL, NULL, NULL, 'PENDING', '2025-11-04 12:11:09'),
(2, 2, 'TRANSFER_OUT', 100.00, 'Transfer to CHIDI', NULL, 'Bank of America', 'CHIDI', '2232323232', 'COMPLETED', '2025-11-04 12:18:00'),
(3, 2, 'TRANSFER_OUT', 100.00, 'Transfer to JOHN', NULL, 'Bank of America', 'JOHN', '2232323232', 'COMPLETED', '2025-11-04 12:20:33'),
(4, 2, 'TRANSFER_OUT', 100.00, 'Transfer to JOHN', NULL, 'Chase Bank', 'JOHN', '2232323232', 'COMPLETED', '2025-11-04 12:33:40'),
(5, 2, 'Transfer', 100.00, 'TRANSFER', NULL, 'Wells Fargo', 'JOHN', '2232323232', 'COMPLETED', '2025-11-04 13:02:19'),
(6, 2, 'Deposit', 600.00, NULL, 'Balance', NULL, NULL, NULL, 'PENDING', '2025-11-04 13:03:05'),
(7, 2, 'Deposit', 1000.00, NULL, 'Balance', NULL, NULL, NULL, 'PENDING', '2025-11-04 13:03:11'),
(8, 2, 'Transfer', 100.00, NULL, 'Transfer Pending', NULL, NULL, NULL, 'PENDING', '2025-11-04 13:03:53'),
(9, 2, 'Transfer', 100.00, 'Transfer', NULL, 'Wells Fargo', 'CHIDI', '2232323232', 'COMPLETED', '2025-11-04 13:24:33'),
(10, 2, 'Transfer', 100.00, 'Transfer', NULL, 'Chase Bank', 'CHIDI', '2232323232', 'COMPLETED', '2025-11-05 01:47:57'),
(11, 2, 'Transfer', 100.00, 'Transfer', NULL, 'Other', 'CHIDI', '2232323232', 'COMPLETED', '2025-11-05 01:51:35'),
(12, 2, 'Transfer', 100.00, 'Transfer', NULL, 'Wells Fargo', 'CHIDI', '5656565656', 'COMPLETED', '2025-11-05 01:56:22');

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `user_id` int(10) UNSIGNED NOT NULL,
  `first_name` varchar(50) NOT NULL,
  `middle_name` varchar(50) DEFAULT NULL,
  `last_name` varchar(50) DEFAULT NULL,
  `date_of_birth` date DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `zip_code` varchar(10) DEFAULT NULL,
  `city` varchar(50) DEFAULT NULL,
  `state` varchar(50) DEFAULT NULL,
  `country` varchar(50) DEFAULT NULL,
  `email` varchar(100) NOT NULL,
  `bank_routing_number` varchar(20) DEFAULT NULL,
  `username` varchar(50) NOT NULL,
  `password_hash` varchar(255) NOT NULL,
  `currency_symbol` varchar(5) DEFAULT '$',
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `currency_country` varchar(50) DEFAULT 'United States'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`user_id`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `phone`, `zip_code`, `city`, `state`, `country`, `email`, `bank_routing_number`, `username`, `password_hash`, `currency_symbol`, `created_at`, `currency_country`) VALUES
(1, 'John', NULL, 'Doe', NULL, NULL, NULL, NULL, NULL, NULL, 'john.doe@example.com', NULL, 'john', '$2y$10$hashedpasswordhere', '$', '2025-11-04 12:09:08', 'United States'),
(2, 'CHIDIEBERE', 'JOHN', 'EXECUTIVE', '2025-10-26', '08134582387', '85648', 'CALIFORNIA', 'CALIFORNIA', 'USA', 'hynes6150@gmail.com', '180494719', 'hynes6150', '$2y$10$zQ/nAvw9DQVRLaPIQZHW4OENTM2pFfC.nnuHCkWrP.CHxzyLP.S4S', 'CHF', '2025-11-04 12:09:36', 'Switzerland'),
(3, 'CHIDIEBERE', 'CHIAGOZIE', 'EXECUTIVE', '2025-10-28', '08134582387', '99950', 'CALIFORNIA', 'CALIFORNIA', 'FRANCE', 'goaeri0@gmail.com', '260095635', 'goaeri0', '$2y$10$S4uezbP7hM/2hNjSPqe/Yu8m2Yd0dIojh5F.1ixIBUB2jF2EpWd2q', '$', '2025-11-04 13:14:03', 'United States'),
(4, 'dean', 'CHIAGOZIE', 'EXECUTIVE', '2025-10-27', '08134582387', '090909', 'LEGEND', 'CALIFORNIA', 'FRANCE', 'goaeri1@gmail.com', '286373944', 'goaeri1', '$2y$10$MmgvgM5/b3T7IMb7VJW8/e8Zxxh9GkDeHZ8INKcH8HHEF//8MNR8m', '$', '2025-11-04 13:42:01', 'United States');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `accounts`
--
ALTER TABLE `accounts`
  ADD PRIMARY KEY (`account_id`),
  ADD UNIQUE KEY `account_number` (`account_number`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `atm_cards`
--
ALTER TABLE `atm_cards`
  ADD PRIMARY KEY (`card_id`),
  ADD UNIQUE KEY `card_number` (`card_number`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
  ADD PRIMARY KEY (`transaction_id`),
  ADD KEY `account_id` (`account_id`),
  ADD KEY `type` (`type`),
  ADD KEY `created_at` (`created_at`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`user_id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD UNIQUE KEY `username` (`username`),
  ADD UNIQUE KEY `bank_routing_number` (`bank_routing_number`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `accounts`
--
ALTER TABLE `accounts`
  MODIFY `account_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `atm_cards`
--
ALTER TABLE `atm_cards`
  MODIFY `card_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
  MODIFY `transaction_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `user_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `accounts`
--
ALTER TABLE `accounts`
  ADD CONSTRAINT `accounts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE;

--
-- Constraints for table `atm_cards`
--
ALTER TABLE `atm_cards`
  ADD CONSTRAINT `atm_cards_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE;

--
-- Constraints for table `transactions`
--
ALTER TABLE `transactions`
  ADD CONSTRAINT `transactions_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_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 */;
