SET NAMES utf8mb4;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;

CREATE TABLE IF NOT EXISTS `options` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(191) NOT NULL,
  `value` LONGTEXT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_options_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `users` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NULL,
  `email` VARCHAR(191) NOT NULL,
  `first_name` VARCHAR(120) NULL,
  `last_name` VARCHAR(120) NULL,
  `phone` VARCHAR(50) NULL,
  `password` VARCHAR(255) NULL,
  `status` TINYINT NOT NULL DEFAULT 1,
  `balance` DECIMAL(16,2) NOT NULL DEFAULT 0.00,
  `timezone` VARCHAR(64) NULL,
  `api_credentials` LONGTEXT NULL,
  `ref_id` BIGINT NULL,
  `ref_key` VARCHAR(64) NULL,
  `addons` LONGTEXT NULL,
  `more_information` LONGTEXT NULL,
  `avatar` VARCHAR(255) NULL,
  `activation_key` VARCHAR(64) NULL,
  `reset_key` VARCHAR(64) NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  `deleted_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_users_email` (`email`),
  KEY `ix_users_ref_id` (`ref_id`),
  KEY `ix_users_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `user_roles` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(191) NOT NULL,
  `permissions` LONGTEXT NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_user_roles_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `staffs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NULL,
  `email` VARCHAR(191) NOT NULL,
  `first_name` VARCHAR(120) NULL,
  `last_name` VARCHAR(120) NULL,
  `role_id` BIGINT UNSIGNED NULL,
  `password` VARCHAR(255) NULL,
  `status` TINYINT NOT NULL DEFAULT 1,
  `balance` DECIMAL(16,2) NOT NULL DEFAULT 0.00,
  `more_information` LONGTEXT NULL,
  `avatar` VARCHAR(255) NULL,
  `activation_key` VARCHAR(64) NULL,
  `reset_key` VARCHAR(64) NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  `deleted_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_staffs_email` (`email`),
  KEY `ix_staffs_role_id` (`role_id`),
  KEY `ix_staffs_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `devices` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NULL,
  `uid` BIGINT UNSIGNED NOT NULL,
  `user_email` VARCHAR(191) NULL,
  `device_name` VARCHAR(191) NULL,
  `device_key` VARCHAR(128) NULL,
  `device_ip` VARCHAR(64) NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  `deleted_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_devices_uid` (`uid`),
  KEY `ix_devices_device_key` (`device_key`),
  KEY `ix_devices_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `brands` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `uid` BIGINT UNSIGNED NOT NULL,
  `domain` VARCHAR(191) NULL,
  `ip` VARCHAR(64) NULL,
  `brand_name` VARCHAR(191) NULL,
  `brand_key` VARCHAR(191) NOT NULL,
  `brand_logo` VARCHAR(255) NULL,
  `meta` LONGTEXT NULL,
  `fees` DECIMAL(16,2) NOT NULL DEFAULT 0.00,
  `fees_type` TINYINT NOT NULL DEFAULT 0,
  `currency` VARCHAR(16) NULL,
  `status` TINYINT NOT NULL DEFAULT 1,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  `deleted_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_brands_brand_key` (`brand_key`),
  UNIQUE KEY `ux_brands_domain` (`domain`),
  KEY `ix_brands_uid` (`uid`),
  KEY `ix_brands_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `plans` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NULL,
  `name` VARCHAR(191) NOT NULL,
  `description` LONGTEXT NULL,
  `price` DECIMAL(16,2) NOT NULL DEFAULT 0.00,
  `final_price` DECIMAL(16,2) NOT NULL DEFAULT 0.00,
  `duration` INT NOT NULL DEFAULT 0,
  `duration_type` TINYINT NOT NULL DEFAULT 0,
  `device` INT NOT NULL DEFAULT 0,
  `brand` INT NOT NULL DEFAULT 0,
  `transaction` INT NOT NULL DEFAULT 0,
  `website` INT NOT NULL DEFAULT 0,
  `sort` INT NOT NULL DEFAULT 0,
  `status` TINYINT NOT NULL DEFAULT 1,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  `deleted_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_plans_status` (`status`),
  KEY `ix_plans_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `user_plans` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `uid` BIGINT UNSIGNED NOT NULL,
  `plan_id` BIGINT UNSIGNED NOT NULL,
  `device` INT NOT NULL DEFAULT 0,
  `brand` INT NOT NULL DEFAULT 0,
  `transaction` INT NOT NULL DEFAULT 0,
  `expire` DATETIME NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_user_plans_uid` (`uid`),
  KEY `ix_user_plans_plan_id` (`plan_id`),
  KEY `ix_user_plans_expire` (`expire`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `payments` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `type` VARCHAR(64) NOT NULL,
  `name` VARCHAR(191) NOT NULL,
  `sort` INT NOT NULL DEFAULT 0,
  `status` TINYINT NOT NULL DEFAULT 1,
  `params` LONGTEXT NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_payments_type` (`type`),
  KEY `ix_payments_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `user_payment_settings` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `uid` BIGINT UNSIGNED NOT NULL,
  `brand_id` BIGINT UNSIGNED NOT NULL,
  `g_type` VARCHAR(64) NOT NULL,
  `t_type` VARCHAR(32) NULL,
  `params` LONGTEXT NULL,
  `status` TINYINT NOT NULL DEFAULT 1,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_user_payment_settings` (`uid`, `brand_id`, `g_type`),
  KEY `ix_user_payment_settings_brand_id` (`brand_id`),
  KEY `ix_user_payment_settings_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `temp_transactions` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NOT NULL,
  `uid` BIGINT UNSIGNED NOT NULL,
  `brand_id` BIGINT UNSIGNED NOT NULL,
  `params` LONGTEXT NULL,
  `meta` LONGTEXT NULL,
  `request` VARCHAR(16) NULL,
  `amount` DECIMAL(16,2) NOT NULL DEFAULT 0.00,
  `transaction_id` VARCHAR(64) NOT NULL,
  `status` INT NOT NULL DEFAULT 0,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_temp_transactions_ids` (`ids`),
  UNIQUE KEY `ux_temp_transactions_transaction_id` (`transaction_id`),
  KEY `ix_temp_transactions_uid` (`uid`),
  KEY `ix_temp_transactions_brand_id` (`brand_id`),
  KEY `ix_temp_transactions_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `transactions` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NOT NULL,
  `uid` BIGINT UNSIGNED NOT NULL,
  `brand_id` BIGINT UNSIGNED NULL,
  `type` VARCHAR(64) NULL,
  `status` INT NOT NULL DEFAULT 0,
  `transaction_id` VARCHAR(64) NOT NULL,
  `message` LONGTEXT NULL,
  `amount` DECIMAL(16,2) NOT NULL DEFAULT 0.00,
  `currency` VARCHAR(16) NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_transactions_transaction_id` (`transaction_id`),
  KEY `ix_transactions_ids` (`ids`),
  KEY `ix_transactions_uid` (`uid`),
  KEY `ix_transactions_brand_id` (`brand_id`),
  KEY `ix_transactions_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `module_data` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `tmp_id` VARCHAR(64) NULL,
  `ids` VARCHAR(64) NULL,
  `uid` BIGINT UNSIGNED NOT NULL,
  `address` VARCHAR(191) NULL,
  `message` LONGTEXT NULL,
  `status` INT NOT NULL DEFAULT 0,
  `created_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_module_data_tmp_id` (`tmp_id`),
  KEY `ix_module_data_uid` (`uid`),
  KEY `ix_module_data_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `bank_transaction_logs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NOT NULL,
  `uid` BIGINT UNSIGNED NOT NULL,
  `brand_id` BIGINT UNSIGNED NOT NULL,
  `files` LONGTEXT NULL,
  `status` INT NOT NULL DEFAULT 0,
  `type` VARCHAR(64) NULL,
  `created_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_bank_transaction_logs_ids` (`ids`),
  KEY `ix_bank_transaction_logs_uid` (`uid`),
  KEY `ix_bank_transaction_logs_brand_id` (`brand_id`),
  KEY `ix_bank_transaction_logs_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `user_transactions` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NULL,
  `uid` BIGINT UNSIGNED NOT NULL,
  `type` VARCHAR(64) NULL,
  `transaction_id` VARCHAR(64) NOT NULL,
  `amount` DECIMAL(16,2) NOT NULL DEFAULT 0.00,
  `information` LONGTEXT NULL,
  `status` INT NOT NULL DEFAULT 0,
  `currency` VARCHAR(16) NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_user_transactions_transaction_id` (`transaction_id`),
  KEY `ix_user_transactions_uid` (`uid`),
  KEY `ix_user_transactions_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `invoice` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NOT NULL,
  `uid` BIGINT UNSIGNED NOT NULL,
  `customer_name` VARCHAR(191) NULL,
  `customer_number` VARCHAR(64) NULL,
  `customer_amount` DECIMAL(16,2) NOT NULL DEFAULT 0.00,
  `customer_email` VARCHAR(191) NULL,
  `customer_address` LONGTEXT NULL,
  `customer_description` LONGTEXT NULL,
  `status` INT NOT NULL DEFAULT 1,
  `pay_status` INT NOT NULL DEFAULT 0,
  `brand_id` BIGINT UNSIGNED NULL,
  `transaction_id` VARCHAR(64) NULL,
  `extras` LONGTEXT NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  `deleted_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_invoice_ids` (`ids`),
  KEY `ix_invoice_uid` (`uid`),
  KEY `ix_invoice_brand_id` (`brand_id`),
  KEY `ix_invoice_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `email_templates` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `uid` BIGINT UNSIGNED NOT NULL,
  `template_key` VARCHAR(64) NOT NULL,
  `email_from` VARCHAR(191) NULL,
  `name` VARCHAR(191) NULL,
  `sms_status` TINYINT NOT NULL DEFAULT 0,
  `sms_body` LONGTEXT NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_email_templates` (`uid`, `template_key`),
  KEY `ix_email_templates_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `notifications` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `uid` BIGINT UNSIGNED NOT NULL,
  `message` LONGTEXT NULL,
  `admin_status` TINYINT NOT NULL DEFAULT 1,
  `created_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_notifications_uid` (`uid`),
  KEY `ix_notifications_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `affiliates` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `uid` BIGINT UNSIGNED NOT NULL,
  `ref_id` BIGINT UNSIGNED NOT NULL,
  `amount` DECIMAL(16,2) NOT NULL DEFAULT 0.00,
  `created_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_affiliates_uid` (`uid`),
  KEY `ix_affiliates_ref_id` (`ref_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `tickets` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NULL,
  `uid` BIGINT UNSIGNED NOT NULL,
  `subject` VARCHAR(191) NULL,
  `description` LONGTEXT NULL,
  `status` VARCHAR(32) NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  `deleted_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_tickets_uid` (`uid`),
  KEY `ix_tickets_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `ticket_messages` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NULL,
  `ticket_id` BIGINT UNSIGNED NOT NULL,
  `uid` BIGINT UNSIGNED NOT NULL,
  `message` LONGTEXT NULL,
  `created_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_ticket_messages_ticket_id` (`ticket_id`),
  KEY `ix_ticket_messages_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `blogs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NULL,
  `title` VARCHAR(255) NULL,
  `uri` VARCHAR(255) NULL,
  `thumbnail` VARCHAR(255) NULL,
  `description` LONGTEXT NULL,
  `status` TINYINT NOT NULL DEFAULT 1,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  `deleted_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_blogs_uri` (`uri`),
  KEY `ix_blogs_status` (`status`),
  KEY `ix_blogs_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `faqs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `question` VARCHAR(255) NULL,
  `answer` LONGTEXT NULL,
  `sort` INT NOT NULL DEFAULT 0,
  `status` TINYINT NOT NULL DEFAULT 1,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  `deleted_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_faqs_status` (`status`),
  KEY `ix_faqs_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `addons` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(191) NULL,
  `slug` VARCHAR(191) NULL,
  `params` LONGTEXT NULL,
  `status` TINYINT NOT NULL DEFAULT 1,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_addons_slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `coupons` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `code` VARCHAR(64) NULL,
  `discount_type` TINYINT NULL,
  `discount` DECIMAL(16,2) NULL,
  `status` TINYINT NOT NULL DEFAULT 1,
  `expire` DATETIME NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  `deleted_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_coupons_code` (`code`),
  KEY `ix_coupons_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `kyc` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ids` VARCHAR(64) NULL,
  `uid` BIGINT UNSIGNED NOT NULL,
  `status` INT NOT NULL DEFAULT 0,
  `files` LONGTEXT NULL,
  `meta` LONGTEXT NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_kyc_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `activity_logs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `uid` BIGINT UNSIGNED NULL,
  `action` VARCHAR(191) NULL,
  `module` VARCHAR(64) NULL,
  `ip` VARCHAR(64) NULL,
  `user_agent` VARCHAR(255) NULL,
  `created_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_activity_logs_uid` (`uid`),
  KEY `ix_activity_logs_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `admin_activity_logs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `uid` BIGINT UNSIGNED NULL,
  `action` VARCHAR(191) NULL,
  `module` VARCHAR(64) NULL,
  `ip` VARCHAR(64) NULL,
  `user_agent` VARCHAR(255) NULL,
  `created_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  KEY `ix_admin_activity_logs_uid` (`uid`),
  KEY `ix_admin_activity_logs_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `payments` (`id`, `type`, `name`, `sort`, `status`, `params`, `created_at`, `updated_at`)
VALUES (1, 'gateway', 'Gateway', 1, 1, '{}', NOW(), NOW())
ON DUPLICATE KEY UPDATE `type`=VALUES(`type`), `name`=VALUES(`name`), `sort`=VALUES(`sort`), `status`=VALUES(`status`), `params`=VALUES(`params`);

INSERT INTO `plans` (`id`, `ids`, `name`, `description`, `price`, `final_price`, `duration`, `duration_type`, `device`, `brand`, `transaction`, `website`, `sort`, `status`, `created_at`, `updated_at`)
VALUES (1, 'FREEPLAN', 'Free', 'Free plan', 0.00, 0.00, 3650, 1, -1, -1, -1, 1, 1, 1, NOW(), NOW())
ON DUPLICATE KEY UPDATE `name`=VALUES(`name`), `description`=VALUES(`description`), `price`=VALUES(`price`), `final_price`=VALUES(`final_price`), `duration`=VALUES(`duration`), `duration_type`=VALUES(`duration_type`), `device`=VALUES(`device`), `brand`=VALUES(`brand`), `transaction`=VALUES(`transaction`), `website`=VALUES(`website`), `sort`=VALUES(`sort`), `status`=VALUES(`status`);

SET foreign_key_checks = 1;
