--
-- Host: localhost    Database: control_financiero
-- ------------------------------------------------------


--
-- Table structure for table `alerts`
--

CREATE TABLE `alerts` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `title` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `is_read` tinyint(1) NOT NULL DEFAULT 0,
  `related_type` varchar(255) DEFAULT NULL,
  `related_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `alerts_user_id_foreign` (`user_id`),
  CONSTRAINT `alerts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `alerts`
--


--
-- Table structure for table `credit_cards`
--

CREATE TABLE `credit_cards` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `entity_name` varchar(255) NOT NULL,
  `card_name` varchar(255) NOT NULL,
  `card_masked` varchar(4) NOT NULL,
  `credit_limit` decimal(12,2) NOT NULL,
  `current_debt` decimal(12,2) NOT NULL DEFAULT 0.00,
  `currency` varchar(255) NOT NULL DEFAULT 'PEN',
  `closing_day` int(11) NOT NULL,
  `payment_day` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `credit_cards_user_id_foreign` (`user_id`),
  CONSTRAINT `credit_cards_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `credit_cards`
--


--
-- 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`
--


--
-- Table structure for table `gmail_processed_emails`
--

CREATE TABLE `gmail_processed_emails` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `message_id` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `gmail_processed_emails_user_id_foreign` (`user_id`),
  KEY `gmail_processed_emails_message_id_index` (`message_id`),
  CONSTRAINT `gmail_processed_emails_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `gmail_processed_emails`
--

INSERT INTO `gmail_processed_emails` VALUES (1,1,'19f2476887403639','2026-07-03 09:14:11','2026-07-03 09:14:11'),(2,1,'19f20b05a5036a1f','2026-07-03 09:14:11','2026-07-03 09:14:11'),(3,1,'19f1ea8716055358','2026-07-03 09:14:12','2026-07-03 09:14:12'),(4,1,'19f1e41828ffcdab','2026-07-03 09:14:12','2026-07-03 09:14:12'),(5,1,'19f1aeab21357725','2026-07-03 09:14:12','2026-07-03 09:14:12'),(6,1,'19f1ae6810a7d627','2026-07-03 09:14:13','2026-07-03 09:14:13'),(7,1,'19f1ad263d94d4aa','2026-07-03 09:14:13','2026-07-03 09:14:13'),(8,1,'19f18f6bc550affb','2026-07-03 09:14:14','2026-07-03 09:14:14'),(9,1,'19f13c64af2c1554','2026-07-03 09:14:14','2026-07-03 09:14:14'),(10,1,'19f13c267ad04386','2026-07-03 09:14:14','2026-07-03 09:14:14'),(11,1,'19f0ebccf29bca69','2026-07-03 09:14:14','2026-07-03 09:14:14'),(12,1,'19f0af6730f49d6f','2026-07-03 09:14:15','2026-07-03 09:14:15'),(13,1,'19f0a00ea6f21c16','2026-07-03 09:14:15','2026-07-03 09:14:15'),(14,1,'19f09a3fcbd8bc66','2026-07-03 09:14:16','2026-07-03 09:14:16'),(15,1,'19f06287111f5a13','2026-07-03 09:14:16','2026-07-03 09:14:16'),(16,1,'19f05c5880ad4d95','2026-07-03 09:14:17','2026-07-03 09:14:17'),(17,1,'19f058d9f2f3a274','2026-07-03 09:14:17','2026-07-03 09:14:17'),(18,1,'19f007904c6a771f','2026-07-03 09:14:17','2026-07-03 09:14:17'),(19,1,'19efff2a079b1e27','2026-07-03 09:14:18','2026-07-03 09:14:18'),(20,1,'19eff43872474522','2026-07-03 09:14:18','2026-07-03 09:14:18'),(21,1,'19eff179676437bc','2026-07-03 09:14:19','2026-07-03 09:14:19'),(22,1,'19efc553b8eb8314','2026-07-03 09:14:20','2026-07-03 09:14:20'),(23,1,'19ef72426e1aa2d7','2026-07-03 09:14:20','2026-07-03 09:14:20'),(24,1,'19ef5c53b7d92a9a','2026-07-03 09:14:20','2026-07-03 09:14:20'),(25,1,'19ef586d510d7103','2026-07-03 09:14:21','2026-07-03 09:14:21'),(26,1,'19eefd6b96d84cbd','2026-07-03 09:14:21','2026-07-03 09:14:21'),(27,1,'19eef9aa6761bddd','2026-07-03 09:14:22','2026-07-03 09:14:22'),(28,1,'19eecf57db00dc35','2026-07-03 09:14:22','2026-07-03 09:14:22'),(29,1,'19eecf0b974273e7','2026-07-03 09:14:23','2026-07-03 09:14:23'),(30,1,'19ee61c91a6c61c2','2026-07-03 09:14:24','2026-07-03 09:14:24'),(31,1,'19ee5c5acb5b2b2b','2026-07-03 09:14:24','2026-07-03 09:14:24'),(32,1,'19ee0d9047475062','2026-07-03 09:14:25','2026-07-03 09:14:25'),(33,1,'19edc95569d2c606','2026-07-03 09:14:25','2026-07-03 09:14:25'),(34,1,'19edc943ec5444f0','2026-07-03 09:14:26','2026-07-03 09:14:26'),(35,1,'19ed24a300084b90','2026-07-03 09:14:26','2026-07-03 09:14:26'),(36,1,'19ed165b68b06d0e','2026-07-03 09:14:27','2026-07-03 09:14:27'),(37,1,'19ed121b77cb9673','2026-07-03 09:14:27','2026-07-03 09:14:27'),(38,1,'19ecd74dabe45175','2026-07-03 09:14:28','2026-07-03 09:14:28'),(39,1,'19ecd7268ce86f56','2026-07-03 09:14:29','2026-07-03 09:14:29'),(40,1,'19eccfd2a5488d20','2026-07-03 09:14:29','2026-07-03 09:14:29'),(41,1,'19ec18bf48d74611','2026-07-03 09:14:29','2026-07-03 09:14:29'),(42,1,'19ebad0d36c988e3','2026-07-03 09:14:30','2026-07-03 09:14:30'),(43,1,'19eb86bd372ba88f','2026-07-03 09:14:30','2026-07-03 09:14:30'),(44,1,'19eb73421aa26dc9','2026-07-03 09:14:31','2026-07-03 09:14:31'),(45,1,'19eafc7e5fd1225c','2026-07-03 09:14:32','2026-07-03 09:14:32'),(46,1,'19eaeb747a6b47f6','2026-07-03 09:14:32','2026-07-03 09:14:32'),(47,1,'19eae6b04bd10d84','2026-07-03 09:14:32','2026-07-03 09:14:32'),(48,1,'19eadaede674aac4','2026-07-03 09:14:33','2026-07-03 09:14:33'),(49,1,'19ea77f9018fdec4','2026-07-03 09:14:33','2026-07-03 09:14:33'),(50,1,'19ea339a246b6ca0','2026-07-03 09:14:35','2026-07-03 09:14:35'),(51,1,'19e9d82a7297a3eb','2026-07-03 09:14:35','2026-07-03 09:14:35'),(52,1,'19e8f40926058128','2026-07-03 09:14:36','2026-07-03 09:14:36'),(53,1,'19e8aa0f43e07f4b','2026-07-03 09:14:36','2026-07-03 09:14:36'),(54,1,'19e8654628769278','2026-07-03 09:14:37','2026-07-03 09:14:37'),(55,1,'19e8589a5237a988','2026-07-03 09:14:37','2026-07-03 09:14:37'),(56,1,'19e8378f1ce31107','2026-07-03 09:14:38','2026-07-03 09:14:38'),(57,1,'19e7b54c78fbe612','2026-07-03 09:14:38','2026-07-03 09:14:38'),(58,1,'19e7b544b53c575f','2026-07-03 09:14:38','2026-07-03 09:14:38'),(59,1,'19e7976943742bff','2026-07-03 09:14:39','2026-07-03 09:14:39'),(60,1,'19e791f818242d83','2026-07-03 09:14:39','2026-07-03 09:14:39'),(61,1,'19e6bae6d76b6aaf','2026-07-03 09:14:39','2026-07-03 09:14:39'),(62,1,'19e6ac2b4cac050e','2026-07-03 09:14:40','2026-07-03 09:14:40'),(63,1,'19e6a6a8e03888fb','2026-07-03 09:14:40','2026-07-03 09:14:40'),(64,1,'19e68b21fd569e1c','2026-07-03 09:14:40','2026-07-03 09:14:40'),(65,1,'19e6605b62aa7f17','2026-07-03 09:14:41','2026-07-03 09:14:41'),(66,1,'19e65e89d0e1b57b','2026-07-03 09:14:41','2026-07-03 09:14:41'),(67,1,'19e658526dfa5097','2026-07-03 09:14:42','2026-07-03 09:14:42'),(68,1,'19e6517284b92082','2026-07-03 09:14:42','2026-07-03 09:14:42'),(69,1,'19e616b9317ff35e','2026-07-03 09:14:43','2026-07-03 09:14:43'),(70,1,'19e613861ee2e0e3','2026-07-03 09:14:43','2026-07-03 09:14:43'),(71,1,'19e5b46db50a6381','2026-07-03 09:14:43','2026-07-03 09:14:43'),(72,1,'19e57098e6194d59','2026-07-03 09:14:44','2026-07-03 09:14:44'),(73,1,'19e56c6b87e5942a','2026-07-03 09:14:44','2026-07-03 09:14:44'),(74,1,'19e56995b1b404bb','2026-07-03 09:14:45','2026-07-03 09:14:45'),(75,1,'19e5697b6e3f1bbe','2026-07-03 09:14:45','2026-07-03 09:14:45'),(76,1,'19e56947e247c275','2026-07-03 09:14:45','2026-07-03 09:14:45'),(77,1,'19e5662c39e2c70f','2026-07-03 09:14:46','2026-07-03 09:14:46'),(78,1,'19e556a192f34890','2026-07-03 09:14:46','2026-07-03 09:14:46'),(79,1,'19e55568e0a86c2f','2026-07-03 09:14:47','2026-07-03 09:14:47'),(80,1,'19e4b2736fee1837','2026-07-03 09:14:47','2026-07-03 09:14:47'),(81,1,'19e4778d83f285cc','2026-07-03 09:14:47','2026-07-03 09:14:47'),(82,1,'19e4734cda4dcc92','2026-07-03 09:14:48','2026-07-03 09:14:48'),(83,1,'19e41fde81db9cef','2026-07-03 09:14:48','2026-07-03 09:14:48'),(84,1,'19e41ed2d1934b62','2026-07-03 09:14:49','2026-07-03 09:14:49'),(85,1,'19e41d91e2008af4','2026-07-03 09:14:49','2026-07-03 09:14:49'),(86,1,'19e419d550c2bc3e','2026-07-03 09:14:49','2026-07-03 09:14:49'),(87,1,'19e4078956a73eb9','2026-07-03 09:14:49','2026-07-03 09:14:49'),(88,1,'19e3d0c51210f8bc','2026-07-03 09:14:50','2026-07-03 09:14:50'),(89,1,'19e364bb130846b4','2026-07-03 09:14:50','2026-07-03 09:14:50'),(90,1,'19e34503e82c5c64','2026-07-03 09:14:51','2026-07-03 09:14:51'),(91,1,'19e3450055d7e1f5','2026-07-03 09:14:51','2026-07-03 09:14:51'),(92,1,'19e3449ecfc74c41','2026-07-03 09:14:51','2026-07-03 09:14:51'),(93,1,'19e33943ab9e847b','2026-07-03 09:14:52','2026-07-03 09:14:52'),(94,1,'19e317b36fee97c2','2026-07-03 09:14:52','2026-07-03 09:14:52'),(95,1,'19e3154e1384e76c','2026-07-03 09:14:53','2026-07-03 09:14:53'),(96,1,'19e30cd34bf88e53','2026-07-03 09:14:53','2026-07-03 09:14:53'),(97,1,'19e308509eca1dc4','2026-07-03 09:14:53','2026-07-03 09:14:53'),(98,1,'19e3083c72942947','2026-07-03 09:14:54','2026-07-03 09:14:54'),(99,1,'19e2e75142305562','2026-07-03 09:14:54','2026-07-03 09:14:54'),(100,1,'19e2e70980091aa8','2026-07-03 09:14:54','2026-07-03 09:14:54');

--
-- 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`
--


--
-- 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`
--


--
-- Table structure for table `merchant_category_rules`
--

CREATE TABLE `merchant_category_rules` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `merchant_name` varchar(255) NOT NULL,
  `category` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `merchant_category_rules_user_id_merchant_name_unique` (`user_id`,`merchant_name`),
  CONSTRAINT `merchant_category_rules_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `merchant_category_rules`
--


--
-- 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`
--

INSERT INTO `migrations` 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_07_01_180001_create_gmail_connections_table',1),(5,'2026_07_01_180002_create_payments_table',1),(6,'2026_07_01_180003_create_transactions_table',1),(7,'2026_07_01_180004_create_alerts_table',1),(8,'2026_07_01_223559_create_personal_access_tokens_table',2),(9,'2026_07_02_162932_create_gmail_processed_emails_table',3),(10,'2026_07_02_162940_create_merchant_category_rules_table',3),(11,'2026_07_02_163117_add_category_to_transactions_table',4),(12,'2026_07_02_170701_create_credit_cards_table',5),(13,'2026_07_02_170702_add_credit_card_fields_to_payments_table',5),(14,'2026_07_12_231437_add_credit_card_fields_to_transactions_table',6);

--
-- 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`
--

INSERT INTO `sessions` VALUES ('4TamQaK2UKxY9TKNrFs254bONhOu0JSbZYWXbE5e',NULL,'127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36','YTozOntzOjY6Il90b2tlbiI7czo0MDoiWHZyY2s0NEhBeDlCaUdYT2M2RElzVU8ycVoySTRyeFhDT2taUGZCbCI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NDg6Imh0dHA6Ly9zaGFraW5lc3MtZGVzdGlueS1hYnNpbnRoZS5uZ3Jvay1mcmVlLmRldiI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1783005301);


