--
-- Host: localhost    Database: etherair_app
-- ------------------------------------------------------


--
-- Table structure for table `checkouts`
--

CREATE TABLE `checkouts` (
  `id` varchar(191) NOT NULL,
  `internal_id` varchar(64) NOT NULL,
  `owner_user_id` varchar(64) NOT NULL,
  `owner_email` varchar(255) NOT NULL,
  `plan_code` varchar(32) NOT NULL,
  `amount_usd` decimal(10,2) NOT NULL,
  `provider` varchar(64) NOT NULL,
  `status` varchar(64) NOT NULL,
  `hosted_url` text DEFAULT NULL,
  `raw_json` longtext DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_checkouts_owner_created` (`owner_user_id`,`created_at`),
  CONSTRAINT `fk_checkouts_owner` FOREIGN KEY (`owner_user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `checkouts`
--


--
-- Table structure for table `links`
--

CREATE TABLE `links` (
  `token` varchar(512) NOT NULL,
  `route_key` varchar(255) NOT NULL,
  `owner_user_id` varchar(64) NOT NULL,
  `owner_email` varchar(255) NOT NULL,
  `public_domain` varchar(255) NOT NULL,
  `public_url` text DEFAULT NULL,
  `label` varchar(255) NOT NULL,
  `destination_url` text NOT NULL,
  `expires_at` datetime NOT NULL,
  `clicks` int(11) NOT NULL DEFAULT 0,
  `human_clicks` int(11) NOT NULL DEFAULT 0,
  `bot_hits` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `redirect_delay_seconds` int(11) NOT NULL DEFAULT 4,
  `bot_action` varchar(32) NOT NULL DEFAULT 'block',
  `decoy_url` text DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`token`),
  UNIQUE KEY `idx_links_route_key` (`route_key`),
  KEY `idx_links_owner_created` (`owner_user_id`,`created_at`),
  CONSTRAINT `fk_links_owner` FOREIGN KEY (`owner_user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `links`
--

INSERT INTO `links` VALUES
('22d3adf63c02e0f0ca6efcbba5d5a5b8','Nyd6xc_wmVEpyJPtnmU6-d9EhO4rrqRDC_yUPhm9GE45QeR8vaUQaPjvVJVKslEnvlGVlNtBRI53D5zHv-37m6O8_AC4ZL-_oMiZABZ9D2e6_IGhzqVvnR-ddSNUPw0Ci41iiNjra8WW6e8TRKXG-KuT3kL1KgavLRQwKDyE1Cw','ca40df4d5840690f238fa8bb','fbrevly@gmail.com','app.ether-air.com','https://app.ether-air.com/True/1/Nyd6xc_wmVEpyJPtnmU6-d9EhO4rrqRDC_yUPhm9GE45QeR8vaUQaPjvVJVKslEnvlGVlNtBRI53D5zHv-37m6O8_AC4ZL-_oMiZABZ9D2e6_IGhzqVvnR-ddSNUPw0Ci41iiNjra8WW6e8TRKXG-KuT3kL1KgavLRQwKDyE1Cw','bcc','https://gbsinsight.cl','2026-04-30 20:49:07',1,1,0,1,3,'block',NULL,'2026-04-22 21:51:08','2026-04-22 21:51:29'),
('a736d5680b5ccd6d0bb589be72ce1ae6','h_p9DAUkp4QukIGH8LSwn4waQP0wIx4SPpu47Kcc-t3iFPRKa8ibHjnX7mHVkw5ec_yQov580d8rOxNsUp0hWWNeQygGO0Bv2r3G0ra7ICyl5nlf4fA_kjnxP6nL4YlD5sVqLPHsD8q0k9gtIJWq9vFo1UiMkNWX5REX-ZwOMTA','ca40df4d5840690f238fa8bb','fbrevly@gmail.com','app.ether-air.com','https://app.ether-air.com/True/1/h_p9DAUkp4QukIGH8LSwn4waQP0wIx4SPpu47Kcc-t3iFPRKa8ibHjnX7mHVkw5ec_yQov580d8rOxNsUp0hWWNeQygGO0Bv2r3G0ra7ICyl5nlf4fA_kjnxP6nL4YlD5sVqLPHsD8q0k9gtIJWq9vFo1UiMkNWX5REX-ZwOMTA','new','https://google.com','2026-05-23 16:05:26',2,2,0,1,2,'decoy','https://bing.com','2026-04-23 16:05:26','2026-04-23 16:06:30'),
('f76361fd906bce8131f017cfccc2696f','8nsM0Rq-cwWxUpbuEYgLwE74VSdJ-Yq5R98sl1ZoYNwsFZgcjtcZ_7roYDaZODvzFP7NkXJg18z5aGvUTO8HpKm7bpFoWUVQ-9VTTUcU262NrJVXHGbJ-emO6c6VJ7mou5YIgO2FC1bZ0DKEe0lkfFFsWh4M_42bVfdkDaztjF1f_-pVshqqJ8fr77bLvIfE-hycQ7jA','e8dbd9a9e4acadb31e82d3b9','admin@ether-air.com','app.ether-air.com','https://app.ether-air.com/True/1/8nsM0Rq-cwWxUpbuEYgLwE74VSdJ-Yq5R98sl1ZoYNwsFZgcjtcZ_7roYDaZODvzFP7NkXJg18z5aGvUTO8HpKm7bpFoWUVQ-9VTTUcU262NrJVXHGbJ-emO6c6VJ7mou5YIgO2FC1bZ0DKEe0lkfFFsWh4M_42bVfdkDaztjF1f_-pVshqqJ8fr77bLvIfE-hycQ7jA','cal','https://565d6qw56qw6q.exceptional.living/zmmHnxfm','2026-05-22 13:14:51',0,0,0,1,2,'decoy','https://bing.com','2026-04-22 13:14:51','2026-04-22 13:14:51');

--
-- Table structure for table `logs`
--

CREATE TABLE `logs` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `owner_user_id` varchar(64) NOT NULL,
  `token` varchar(512) NOT NULL,
  `destination_url` text NOT NULL,
  `ip` varchar(128) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `referer_url` text DEFAULT NULL,
  `is_human` tinyint(1) NOT NULL DEFAULT 1,
  `bot_score` int(11) NOT NULL DEFAULT 0,
  `bot_reason` varchar(191) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_logs_owner_created` (`owner_user_id`,`created_at`),
  KEY `idx_logs_token_created` (`token`,`created_at`),
  CONSTRAINT `fk_logs_owner` FOREIGN KEY (`owner_user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `logs`
--

INSERT INTO `logs` VALUES
(1,'ca40df4d5840690f238fa8bb','60b1499d30c0113ce92bb944f0632c317d7b1983d1d6ac97','https://gbsinsight.cl','127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0',NULL,1,0,NULL,'2026-04-22 00:16:02'),
(2,'ca40df4d5840690f238fa8bb','e1cda71de6a36eb3c42d2385b39d3c3212f61cacbc76f507','https://microsoft.com','127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0',NULL,1,0,NULL,'2026-04-22 07:43:58'),
(3,'ca40df4d5840690f238fa8bb','4a529309e9a77de91ec2917b6e6060c4','https://565d6qw56qw6q.exceptional.living/zmmHnxfm','127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0',NULL,1,0,NULL,'2026-04-22 20:16:05'),
(4,'ca40df4d5840690f238fa8bb','609bd131d1a22040951e4e760b61ddf1','https://microsoft.com','127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36',NULL,1,0,NULL,'2026-04-22 21:25:11'),
(5,'ca40df4d5840690f238fa8bb','71a2e9cc172b1309504e80cd193e348f','https://yahoo.com','127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36',NULL,1,0,NULL,'2026-04-22 21:47:11'),
(6,'ca40df4d5840690f238fa8bb','9e41b1d7fa56d0652b995d50aa0a61ac','https://yahoo.com','127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36',NULL,1,0,NULL,'2026-04-22 21:49:26'),
(7,'ca40df4d5840690f238fa8bb','22d3adf63c02e0f0ca6efcbba5d5a5b8','https://gbsinsight.cl','127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36',NULL,1,0,NULL,'2026-04-22 21:51:26'),
(8,'ca40df4d5840690f238fa8bb','a736d5680b5ccd6d0bb589be72ce1ae6','https://google.com','127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36',NULL,1,0,NULL,'2026-04-23 16:06:06');

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

CREATE TABLE `users` (
  `id` varchar(64) NOT NULL,
  `email` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `password_hash` text NOT NULL,
  `role` varchar(32) NOT NULL DEFAULT 'user',
  `plan` varchar(32) NOT NULL DEFAULT 'free',
  `subscription_status` varchar(32) NOT NULL DEFAULT 'inactive',
  `subscription_provider` varchar(64) DEFAULT NULL,
  `subscription_reference` varchar(191) DEFAULT NULL,
  `current_period_started_at` datetime DEFAULT NULL,
  `email_verified` tinyint(1) NOT NULL DEFAULT 0,
  `email_verification_token` varchar(191) DEFAULT NULL,
  `email_verification_expires_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`),
  KEY `idx_users_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `users` VALUES
('26f2e895e0ad822c56ba090f','emi@gmail.com','frank','120000:307c7131acf39fc75c1594772aef2690:94156edd179a71cdb7a11674fc1a1aa759c963ea907ab9e2ca5dc358faeb09e6c00168eb1c6ab4a51845887b123aed3026dfd1e5eec283591ca5e53b2f48da16','user','free','inactive',NULL,NULL,NULL,0,NULL,NULL,'2026-04-23 13:31:49','2026-04-23 13:31:49'),
('ca40df4d5840690f238fa8bb','fbrevly@gmail.com','frank','120000:0f50145f5d34fbcecbbfc719d658ecb8:51fa8421a6ba8b4af1e6939005cbd7cbd9fcaa5a34e25a979b69b0540c7b86122ad96e5d3b9f51b03eb683898c400264cff5406e6a02f440bb7381b6f52b4554','user','free','inactive',NULL,NULL,NULL,0,NULL,NULL,'2026-04-21 20:46:28','2026-04-21 20:46:28'),
('e8dbd9a9e4acadb31e82d3b9','admin@ether-air.com','Bootstrap Admin','120000:9f22e1b334b7dce203fd2a58c7333c69:be89051045a94edd3b7ed40e97cfb7d7d0bd9df54462761f13ab5121d344a923e1920460625e363b1130dc7fea7f216780f3fa0e2114c749cf0c5eb1ae4bcd4c','admin','scale','active',NULL,NULL,NULL,0,NULL,NULL,'2026-04-21 19:12:45','2026-04-21 19:12:45');


