--
-- Host: 127.0.0.1    Database: bank_scrape
-- ------------------------------------------------------


--
-- Table structure for table `bank_accounts`
--

CREATE TABLE `bank_accounts` (
  `id` int NOT NULL AUTO_INCREMENT,
  `bank_name` varchar(50) DEFAULT NULL,
  `account_id` varchar(100) DEFAULT NULL,
  `password` varchar(100) DEFAULT NULL,
  `url` text,
  `profile_path` varchar(255) DEFAULT NULL,
  `active` tinyint(1) DEFAULT '0',
  `available_balance` decimal(15,2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `bank_accounts`
--

INSERT INTO `bank_accounts` VALUES (1,'Citizen Bank','chandraelectronics','Aaaa2222@','https://www.ctznbank.com.np/#/login','C:\\Users\\User\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 2',1,44935.46),(2,'Prabhu Bank','CHANDRA58','Aaaa1111#','https://ibank.prabhubank.com/#/login','C:\\Users\\User\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 3',1,25111.12);

--
-- Table structure for table `bank_transactions`
--

CREATE TABLE `bank_transactions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `transaction_date` varchar(20) DEFAULT NULL,
  `value_date` varchar(20) DEFAULT NULL,
  `cheque_no` varchar(50) DEFAULT NULL,
  `description` text,
  `amount` decimal(15,2) DEFAULT NULL,
  `balance` decimal(15,2) DEFAULT NULL,
  `bank_id` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `done` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `bank_id` (`bank_id`),
  CONSTRAINT `bank_transactions_ibfk_1` FOREIGN KEY (`bank_id`) REFERENCES `bank_accounts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6260 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `bank_transactions`
--


--
-- Table structure for table `error_logs`
--

CREATE TABLE `error_logs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `bank_id` int DEFAULT NULL,
  `timestamp` datetime DEFAULT CURRENT_TIMESTAMP,
  `error_message` text,
  PRIMARY KEY (`id`),
  KEY `bank_id` (`bank_id`),
  CONSTRAINT `error_logs_ibfk_1` FOREIGN KEY (`bank_id`) REFERENCES `bank_accounts` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=287 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `error_logs`
--


--
-- Table structure for table `scrape_status`
--

CREATE TABLE `scrape_status` (
  `id` int NOT NULL AUTO_INCREMENT,
  `bank_id` int DEFAULT NULL,
  `last_scrape_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `bank_id` (`bank_id`),
  CONSTRAINT `scrape_status_ibfk_1` FOREIGN KEY (`bank_id`) REFERENCES `bank_accounts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13222 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `scrape_status`
--

INSERT INTO `scrape_status` VALUES (1,1,'2025-04-04 05:31:47'),(13195,2,'2025-04-04 05:31:47');

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

CREATE TABLE `users` (
  `id` int NOT NULL AUTO_INCREMENT,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `role` enum('admin','user','manager') NOT NULL,
  `bank_assign` json DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

INSERT INTO `users` VALUES (9,'admin@gmail.com','admin12','admin',NULL),(11,'user@gmail.com','user123','user','[\"1\", \"2\"]');


