2022-06-27 20:48:50 +02:00
|
|
|
-- CreateTable
|
2023-01-05 23:40:34 +01:00
|
|
|
CREATE TABLE `user` (
|
|
|
|
`user_id` VARCHAR(36) NOT NULL,
|
2022-06-27 20:48:50 +02:00
|
|
|
`username` VARCHAR(255) NOT NULL,
|
|
|
|
`password` VARCHAR(60) NOT NULL,
|
2023-01-05 23:40:34 +01:00
|
|
|
`role` VARCHAR(50) NOT NULL,
|
2022-06-27 20:48:50 +02:00
|
|
|
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
|
2023-01-05 23:40:34 +01:00
|
|
|
`updated_at` TIMESTAMP(0) NULL,
|
|
|
|
`deleted_at` TIMESTAMP(0) NULL,
|
2022-06-27 20:48:50 +02:00
|
|
|
|
2023-01-05 23:40:34 +01:00
|
|
|
UNIQUE INDEX `user_user_id_key`(`user_id`),
|
|
|
|
UNIQUE INDEX `user_username_key`(`username`),
|
2022-06-27 20:48:50 +02:00
|
|
|
PRIMARY KEY (`user_id`)
|
2023-01-05 23:40:34 +01:00
|
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
2022-06-27 20:48:50 +02:00
|
|
|
|
|
|
|
-- CreateTable
|
|
|
|
CREATE TABLE `session` (
|
2023-01-05 23:40:34 +01:00
|
|
|
`session_id` VARCHAR(36) NOT NULL,
|
|
|
|
`website_id` VARCHAR(36) NOT NULL,
|
2022-06-27 20:48:50 +02:00
|
|
|
`hostname` VARCHAR(100) NULL,
|
|
|
|
`browser` VARCHAR(20) NULL,
|
|
|
|
`os` VARCHAR(20) NULL,
|
|
|
|
`device` VARCHAR(20) NULL,
|
|
|
|
`screen` VARCHAR(11) NULL,
|
|
|
|
`language` VARCHAR(35) NULL,
|
|
|
|
`country` CHAR(2) NULL,
|
2023-04-17 06:07:36 +02:00
|
|
|
`subdivision1` CHAR(20) NULL,
|
2023-03-01 02:40:18 +01:00
|
|
|
`subdivision2` VARCHAR(50) NULL,
|
2023-02-15 18:40:49 +01:00
|
|
|
`city` VARCHAR(50) NULL,
|
2023-01-05 23:40:34 +01:00
|
|
|
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
|
2022-06-27 20:48:50 +02:00
|
|
|
|
2023-01-05 23:40:34 +01:00
|
|
|
UNIQUE INDEX `session_session_id_key`(`session_id`),
|
2022-06-27 20:48:50 +02:00
|
|
|
INDEX `session_created_at_idx`(`created_at`),
|
|
|
|
INDEX `session_website_id_idx`(`website_id`),
|
|
|
|
PRIMARY KEY (`session_id`)
|
2023-01-05 23:40:34 +01:00
|
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
2022-06-27 20:48:50 +02:00
|
|
|
|
|
|
|
-- CreateTable
|
|
|
|
CREATE TABLE `website` (
|
2023-01-05 23:40:34 +01:00
|
|
|
`website_id` VARCHAR(36) NOT NULL,
|
2022-06-27 20:48:50 +02:00
|
|
|
`name` VARCHAR(100) NOT NULL,
|
|
|
|
`domain` VARCHAR(500) NULL,
|
2023-01-05 23:40:34 +01:00
|
|
|
`share_id` VARCHAR(50) NULL,
|
2023-03-27 20:36:21 +02:00
|
|
|
`reset_at` TIMESTAMP(0) NULL,
|
2023-01-05 23:40:34 +01:00
|
|
|
`user_id` VARCHAR(36) NULL,
|
2022-06-27 20:48:50 +02:00
|
|
|
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
|
2023-01-05 23:40:34 +01:00
|
|
|
`updated_at` TIMESTAMP(0) NULL,
|
|
|
|
`deleted_at` TIMESTAMP(0) NULL,
|
2022-06-27 20:48:50 +02:00
|
|
|
|
2023-01-05 23:40:34 +01:00
|
|
|
UNIQUE INDEX `website_website_id_key`(`website_id`),
|
|
|
|
UNIQUE INDEX `website_share_id_key`(`share_id`),
|
2022-06-27 20:48:50 +02:00
|
|
|
INDEX `website_user_id_idx`(`user_id`),
|
2023-01-05 23:40:34 +01:00
|
|
|
INDEX `website_created_at_idx`(`created_at`),
|
|
|
|
INDEX `website_share_id_idx`(`share_id`),
|
2022-06-27 20:48:50 +02:00
|
|
|
PRIMARY KEY (`website_id`)
|
2023-01-05 23:40:34 +01:00
|
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
2022-06-27 20:48:50 +02:00
|
|
|
|
2023-01-05 23:40:34 +01:00
|
|
|
-- CreateTable
|
|
|
|
CREATE TABLE `website_event` (
|
|
|
|
`event_id` VARCHAR(36) NOT NULL,
|
|
|
|
`website_id` VARCHAR(36) NOT NULL,
|
|
|
|
`session_id` VARCHAR(36) NOT NULL,
|
|
|
|
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
|
2023-03-15 01:27:17 +01:00
|
|
|
`url_path` VARCHAR(500) NOT NULL,
|
|
|
|
`url_query` VARCHAR(500) NULL,
|
|
|
|
`referrer_path` VARCHAR(500) NULL,
|
|
|
|
`referrer_query` VARCHAR(500) NULL,
|
|
|
|
`referrer_domain` VARCHAR(500) NULL,
|
2023-02-15 18:40:49 +01:00
|
|
|
`page_title` VARCHAR(500) NULL,
|
2023-01-05 23:40:34 +01:00
|
|
|
`event_type` INTEGER UNSIGNED NOT NULL DEFAULT 1,
|
|
|
|
`event_name` VARCHAR(50) NULL,
|
|
|
|
|
|
|
|
INDEX `website_event_created_at_idx`(`created_at`),
|
|
|
|
INDEX `website_event_session_id_idx`(`session_id`),
|
|
|
|
INDEX `website_event_website_id_idx`(`website_id`),
|
|
|
|
INDEX `website_event_website_id_created_at_idx`(`website_id`, `created_at`),
|
|
|
|
INDEX `website_event_website_id_session_id_created_at_idx`(`website_id`, `session_id`, `created_at`),
|
|
|
|
PRIMARY KEY (`event_id`)
|
|
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
2022-06-27 20:48:50 +02:00
|
|
|
|
2023-03-23 07:02:37 +01:00
|
|
|
-- CreateTable
|
|
|
|
CREATE TABLE `event_data` (
|
|
|
|
`event_id` VARCHAR(36) NOT NULL,
|
|
|
|
`website_event_id` VARCHAR(36) NOT NULL,
|
|
|
|
`website_id` VARCHAR(36) NOT NULL,
|
|
|
|
`event_key` VARCHAR(500) NOT NULL,
|
2023-03-23 22:01:15 +01:00
|
|
|
`event_string_value` VARCHAR(500) NULL,
|
|
|
|
`event_numeric_value` DECIMAL(19, 4) NULL,
|
2023-03-23 07:02:37 +01:00
|
|
|
`event_date_value` TIMESTAMP(0) NULL,
|
|
|
|
`event_data_type` INTEGER UNSIGNED NOT NULL,
|
|
|
|
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
|
|
|
|
|
|
|
|
INDEX `event_data_created_at_idx`(`created_at`),
|
|
|
|
INDEX `event_data_website_id_idx`(`website_id`),
|
|
|
|
INDEX `event_data_website_event_id_idx`(`website_event_id`),
|
|
|
|
INDEX `event_data_website_id_website_event_id_created_at_idx`(`website_id`, `website_event_id`, `created_at`),
|
|
|
|
PRIMARY KEY (`event_id`)
|
|
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
|
2023-01-05 23:40:34 +01:00
|
|
|
-- CreateTable
|
|
|
|
CREATE TABLE `team` (
|
|
|
|
`team_id` VARCHAR(36) NOT NULL,
|
|
|
|
`name` VARCHAR(50) NOT NULL,
|
|
|
|
`access_code` VARCHAR(50) NULL,
|
|
|
|
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
|
|
|
|
`updated_at` TIMESTAMP(0) NULL,
|
2022-06-27 20:48:50 +02:00
|
|
|
|
2023-01-05 23:40:34 +01:00
|
|
|
UNIQUE INDEX `team_team_id_key`(`team_id`),
|
|
|
|
UNIQUE INDEX `team_access_code_key`(`access_code`),
|
|
|
|
INDEX `team_access_code_idx`(`access_code`),
|
|
|
|
PRIMARY KEY (`team_id`)
|
|
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
2022-06-28 18:20:51 +02:00
|
|
|
|
2023-01-05 23:40:34 +01:00
|
|
|
-- CreateTable
|
|
|
|
CREATE TABLE `team_user` (
|
|
|
|
`team_user_id` VARCHAR(36) NOT NULL,
|
|
|
|
`team_id` VARCHAR(36) NOT NULL,
|
|
|
|
`user_id` VARCHAR(36) NOT NULL,
|
|
|
|
`role` VARCHAR(50) NOT NULL,
|
|
|
|
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
|
|
|
|
`updated_at` TIMESTAMP(0) NULL,
|
|
|
|
|
|
|
|
UNIQUE INDEX `team_user_team_user_id_key`(`team_user_id`),
|
|
|
|
INDEX `team_user_team_id_idx`(`team_id`),
|
|
|
|
INDEX `team_user_user_id_idx`(`user_id`),
|
|
|
|
PRIMARY KEY (`team_user_id`)
|
|
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
2023-01-13 20:54:22 +01:00
|
|
|
|
2023-02-02 19:18:06 +01:00
|
|
|
-- CreateTable
|
|
|
|
CREATE TABLE `team_website` (
|
|
|
|
`team_website_id` VARCHAR(36) NOT NULL,
|
|
|
|
`team_id` VARCHAR(36) NOT NULL,
|
|
|
|
`website_id` VARCHAR(36) NOT NULL,
|
|
|
|
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
|
|
|
|
|
|
|
|
UNIQUE INDEX `team_website_team_website_id_key`(`team_website_id`),
|
|
|
|
INDEX `team_website_team_id_idx`(`team_id`),
|
|
|
|
INDEX `team_website_website_id_idx`(`website_id`),
|
|
|
|
PRIMARY KEY (`team_website_id`)
|
|
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
2023-03-27 21:15:22 +02:00
|
|
|
|
|
|
|
-- AddSystemUser
|
2023-04-10 18:56:25 +02:00
|
|
|
INSERT INTO user (user_id, username, role, password) VALUES ('41e2b680-648e-4b09-bcd7-3e2b10c06264' , 'admin', 'admin', '$2b$10$BUli0c.muyCW1ErNJc3jL.vFRFtFJWrT8/GcR4A.sUdCznaXiqFXa');
|