You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
690 lines
26 KiB
SQL
690 lines
26 KiB
SQL
-- Virt Cloud fresh-install schema; no legacy proxy or account-expiry state.
|
|
SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO';
|
|
SET time_zone = '+00:00';
|
|
SET NAMES utf8mb4;
|
|
|
|
CREATE TABLE `announcement` (
|
|
`id` int(11) NOT NULL,
|
|
`title` varchar(120) NOT NULL DEFAULT '',
|
|
`type` varchar(20) NOT NULL DEFAULT 'notice',
|
|
`status` varchar(20) NOT NULL DEFAULT 'withdrawn',
|
|
`body` longtext NOT NULL,
|
|
`published_at` datetime DEFAULT NULL,
|
|
`updated_at` datetime NOT NULL,
|
|
KEY `announcement_published` (`status`,`published_at`,`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
CREATE TABLE `checkout_apply` (
|
|
`id` int(11) NOT NULL,
|
|
`email` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0',
|
|
`userid` bigint(20) NOT NULL DEFAULT 0,
|
|
`money` decimal(12,2) NOT NULL DEFAULT 0.00,
|
|
`zhifubao` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
|
`datetime` bigint(20) DEFAULT NULL,
|
|
`endtime` bigint(21) DEFAULT NULL,
|
|
`status` int(2) DEFAULT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
|
|
|
CREATE TABLE `code` (
|
|
`id` bigint(20) NOT NULL,
|
|
`code` text NOT NULL,
|
|
`type` int(11) NOT NULL,
|
|
`number` decimal(11,2) NOT NULL,
|
|
`isused` int(11) NOT NULL DEFAULT 0,
|
|
`userid` bigint(20) NOT NULL,
|
|
`usedatetime` datetime NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
|
|
|
CREATE TABLE `configurations` (
|
|
`id` int(11) NOT NULL,
|
|
`name` varchar(191) NOT NULL,
|
|
`value` text DEFAULT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
CREATE TABLE `legal_documents` (
|
|
`id` bigint(20) UNSIGNED NOT NULL,
|
|
`slug` varchar(32) NOT NULL,
|
|
`locale` varchar(10) NOT NULL,
|
|
`title` varchar(120) NOT NULL,
|
|
`draft_html` longtext NOT NULL,
|
|
`effective_date` date NOT NULL,
|
|
`draft_version` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`published_revision_id` bigint(20) UNSIGNED DEFAULT NULL,
|
|
`updated_by` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`created_at` datetime NOT NULL,
|
|
`updated_at` datetime NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
CREATE TABLE `legal_document_revisions` (
|
|
`id` bigint(20) UNSIGNED NOT NULL,
|
|
`document_id` bigint(20) UNSIGNED NOT NULL,
|
|
`version` int(10) UNSIGNED NOT NULL,
|
|
`title` varchar(120) NOT NULL,
|
|
`content_html` longtext NOT NULL,
|
|
`effective_date` date NOT NULL,
|
|
`published_at` datetime NOT NULL,
|
|
`published_by` bigint(20) UNSIGNED NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
CREATE TABLE `coupon` (
|
|
`id` bigint(20) NOT NULL,
|
|
`code` text NOT NULL,
|
|
`onetime` int(11) NOT NULL,
|
|
`expire` bigint(20) NOT NULL,
|
|
`shop` text NOT NULL,
|
|
`credit` int(11) NOT NULL,
|
|
`validtimes` int(11) NOT NULL DEFAULT 0
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
|
|
|
CREATE TABLE `usdt_wallets` (
|
|
`id` int(10) UNSIGNED NOT NULL,
|
|
`address` varchar(64) NOT NULL,
|
|
`label` varchar(100) NOT NULL DEFAULT '',
|
|
`enabled` tinyint(1) UNSIGNED NOT NULL DEFAULT 1,
|
|
`sort` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`allocation_cursor` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`last_assigned_at` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`last_scanned_at` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`last_error` varchar(500) NOT NULL DEFAULT '',
|
|
`created_at` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`updated_at` bigint(20) UNSIGNED NOT NULL DEFAULT 0
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `usdt_payment_orders` (
|
|
`id` bigint(20) UNSIGNED NOT NULL,
|
|
`order_no` varchar(32) NOT NULL,
|
|
`business_type` varchar(32) NOT NULL,
|
|
`business_order_no` varchar(64) NOT NULL,
|
|
`paylist_id` bigint(20) UNSIGNED DEFAULT NULL,
|
|
`user_id` bigint(20) UNSIGNED DEFAULT NULL,
|
|
`wallet_id` int(10) UNSIGNED NOT NULL,
|
|
`amount` decimal(12,2) NOT NULL,
|
|
`exchange_rate` decimal(12,4) NOT NULL,
|
|
`actual_amount` decimal(24,6) NOT NULL,
|
|
`amount_atomic` bigint(20) UNSIGNED NOT NULL,
|
|
`currency` varchar(16) NOT NULL DEFAULT 'CNY',
|
|
`token` varchar(24) NOT NULL DEFAULT 'USDT',
|
|
`network` varchar(24) NOT NULL DEFAULT 'tron',
|
|
`contract_address` varchar(64) NOT NULL,
|
|
`receive_address` varchar(64) NOT NULL,
|
|
`status` varchar(20) NOT NULL DEFAULT 'pending',
|
|
`txid` varchar(64) DEFAULT NULL,
|
|
`block_number` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`block_timestamp` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`expires_at` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`paid_at` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`created_at` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`updated_at` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`error_message` varchar(500) NOT NULL DEFAULT ''
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `usdt_chain_transactions` (
|
|
`id` bigint(20) UNSIGNED NOT NULL,
|
|
`event_key` char(64) NOT NULL,
|
|
`txid` char(64) NOT NULL,
|
|
`contract_address` varchar(64) NOT NULL,
|
|
`from_address` varchar(64) NOT NULL,
|
|
`to_address` varchar(64) NOT NULL,
|
|
`amount_atomic` bigint(20) UNSIGNED NOT NULL,
|
|
`block_number` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`block_timestamp` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`payload` mediumtext NOT NULL,
|
|
`status` varchar(20) NOT NULL DEFAULT 'detected',
|
|
`settlement_attempts` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
|
|
`settlement_started_at` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`effect_may_have_applied` tinyint(1) NOT NULL DEFAULT 0,
|
|
`order_no` varchar(32) DEFAULT NULL,
|
|
`detected_at` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`processed_at` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`error_message` varchar(500) NOT NULL DEFAULT ''
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `yipay_orders` (
|
|
`id` bigint(20) UNSIGNED NOT NULL,
|
|
`order_no` varchar(32) NOT NULL,
|
|
`gateway_trade_no` varchar(80) DEFAULT NULL,
|
|
`paylist_id` bigint(20) UNSIGNED NOT NULL,
|
|
`user_id` bigint(20) UNSIGNED NOT NULL,
|
|
`payment_type` varchar(16) NOT NULL,
|
|
`amount` decimal(12,2) NOT NULL,
|
|
`payment_kind` varchar(16) NOT NULL DEFAULT '',
|
|
`payment_value` text DEFAULT NULL,
|
|
`status` varchar(16) NOT NULL DEFAULT 'creating',
|
|
`error_message` varchar(500) NOT NULL DEFAULT '',
|
|
`paid_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`created_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
CONSTRAINT `chk_yipay_order_status` CHECK (`status` IN (
|
|
'creating','pending','paid','refunded','not_created','creation_unknown'
|
|
))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `yipay_callback_events` (
|
|
`id` bigint(20) UNSIGNED NOT NULL,
|
|
`event_key` char(64) NOT NULL,
|
|
`order_no` varchar(32) NOT NULL,
|
|
`gateway_trade_no` varchar(80) NOT NULL,
|
|
`payment_type` varchar(16) NOT NULL,
|
|
`trade_status` varchar(32) NOT NULL,
|
|
`payload` mediumtext NOT NULL,
|
|
`received_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`processed_at` int(10) UNSIGNED NOT NULL DEFAULT 0
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `yipay_refunds` (
|
|
`id` bigint(20) UNSIGNED NOT NULL,
|
|
`order_no` varchar(32) NOT NULL,
|
|
`gateway_trade_no` varchar(80) NOT NULL,
|
|
`amount` decimal(12,2) NOT NULL,
|
|
`status` varchar(16) NOT NULL DEFAULT 'success',
|
|
`gateway_message` varchar(500) NOT NULL DEFAULT '',
|
|
`admin_user_id` bigint(20) UNSIGNED NOT NULL,
|
|
`referral_reversal_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
|
|
`requested_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`completed_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `paytaro_orders` (
|
|
`id` bigint(20) UNSIGNED NOT NULL,
|
|
`order_no` varchar(32) NOT NULL,
|
|
`gateway_trade_no` varchar(80) DEFAULT NULL,
|
|
`paylist_id` bigint(20) UNSIGNED NOT NULL,
|
|
`user_id` bigint(20) UNSIGNED NOT NULL,
|
|
`amount` decimal(12,2) NOT NULL,
|
|
`payment_kind` varchar(16) NOT NULL DEFAULT '',
|
|
`payment_value` text DEFAULT NULL,
|
|
`status` varchar(16) NOT NULL DEFAULT 'creating',
|
|
`error_message` varchar(500) NOT NULL DEFAULT '',
|
|
`paid_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`created_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
CONSTRAINT `chk_paytaro_order_status` CHECK (`status` IN (
|
|
'creating','pending','paid','not_created','creation_unknown'
|
|
))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `paytaro_callback_events` (
|
|
`id` bigint(20) UNSIGNED NOT NULL,
|
|
`event_key` char(64) NOT NULL,
|
|
`order_no` varchar(32) NOT NULL,
|
|
`gateway_trade_no` varchar(80) NOT NULL,
|
|
`trade_status` varchar(32) NOT NULL,
|
|
`payload` mediumtext NOT NULL,
|
|
`received_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`processed_at` int(10) UNSIGNED NOT NULL DEFAULT 0
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `stripe_orders` (
|
|
`id` bigint(20) UNSIGNED NOT NULL,
|
|
`order_no` varchar(32) NOT NULL,
|
|
`checkout_session_id` varchar(255) DEFAULT NULL,
|
|
`payment_intent_id` varchar(255) DEFAULT NULL,
|
|
`paylist_id` bigint(20) UNSIGNED NOT NULL,
|
|
`user_id` bigint(20) UNSIGNED NOT NULL,
|
|
`payment_method` varchar(16) NOT NULL,
|
|
`amount` decimal(12,2) NOT NULL,
|
|
`currency` char(3) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT 'usd',
|
|
`livemode` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
|
|
`checkout_url` text DEFAULT NULL,
|
|
`status` varchar(24) NOT NULL DEFAULT 'creating',
|
|
`error_message` varchar(500) NOT NULL DEFAULT '',
|
|
`paid_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`created_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
CONSTRAINT `chk_stripe_order_method` CHECK (`payment_method` IN ('card','alipay')),
|
|
CONSTRAINT `chk_stripe_order_currency` CHECK (`currency` = 'usd'),
|
|
CONSTRAINT `chk_stripe_order_livemode` CHECK (`livemode` IN (0,1)),
|
|
CONSTRAINT `chk_stripe_order_status` CHECK (`status` IN (
|
|
'creating','pending','paid','failed','expired','not_created','creation_unknown'
|
|
))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
CREATE TABLE `stripe_webhook_events` (
|
|
`id` bigint(20) UNSIGNED NOT NULL,
|
|
`event_id` varchar(255) NOT NULL,
|
|
`event_type` varchar(80) NOT NULL,
|
|
`object_id` varchar(255) NOT NULL,
|
|
`order_no` varchar(32) NOT NULL,
|
|
`livemode` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
|
|
`payload` mediumtext NOT NULL,
|
|
`received_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
`processed_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
|
CONSTRAINT `chk_stripe_event_livemode` CHECK (`livemode` IN (0,1))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
CREATE TABLE `email_verify` (
|
|
`id` bigint(20) NOT NULL,
|
|
`email` text NOT NULL,
|
|
`ip` text NOT NULL,
|
|
`code` text NOT NULL,
|
|
`expire_in` bigint(20) NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
|
|
|
CREATE TABLE `login_ip` (
|
|
`id` bigint(20) NOT NULL,
|
|
`userid` bigint(20) NOT NULL,
|
|
`ip` text NOT NULL,
|
|
`request_domain` varchar(512) DEFAULT NULL,
|
|
`datetime` bigint(20) NOT NULL,
|
|
`type` int(11) NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
|
|
|
CREATE TABLE `payback` (
|
|
`id` bigint(20) NOT NULL,
|
|
`total` decimal(12,2) NOT NULL,
|
|
`userid` bigint(20) NOT NULL,
|
|
`ref_by` bigint(20) NOT NULL,
|
|
`ref_get` decimal(12,2) NOT NULL,
|
|
`datetime` bigint(20) NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
|
|
|
CREATE TABLE `paylist` (
|
|
`id` bigint(20) NOT NULL,
|
|
`userid` bigint(20) NOT NULL,
|
|
`total` decimal(12,2) NOT NULL,
|
|
`status` int(11) NOT NULL DEFAULT 0,
|
|
`tradeno` text DEFAULT NULL,
|
|
`datetime` bigint(20) NOT NULL DEFAULT 0
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
|
|
|
CREATE TABLE `shop` (
|
|
`id` bigint(20) NOT NULL,
|
|
`name` varchar(128) NOT NULL,
|
|
`cpu_cores` int(11) NOT NULL,
|
|
`memory_mib` int(11) NOT NULL,
|
|
`bandwidth_mbps` int(11) NOT NULL,
|
|
`disk_gib` int(11) NOT NULL,
|
|
`validity_days` int(10) unsigned NOT NULL DEFAULT 30,
|
|
`traffic_quota_bytes` bigint(20) unsigned NOT NULL DEFAULT 0,
|
|
`status` tinyint(1) NOT NULL DEFAULT 1,
|
|
`sort` int(11) NOT NULL DEFAULT 0,
|
|
`created_at` bigint(20) unsigned NOT NULL DEFAULT 0,
|
|
`updated_at` bigint(20) unsigned NOT NULL DEFAULT 0
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
CREATE TABLE `ss_invite_code` (
|
|
`id` int(11) NOT NULL,
|
|
`code` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
|
`user_id` int(11) NOT NULL,
|
|
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
|
`updated_at` timestamp NOT NULL DEFAULT '2016-06-01 00:00:00'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
|
|
|
CREATE TABLE `referral_code_generation_locks` (
|
|
`id` tinyint unsigned NOT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
|
|
|
INSERT INTO `referral_code_generation_locks` (`id`) VALUES (1);
|
|
|
|
CREATE TABLE `ss_password_reset` (
|
|
`id` int(11) NOT NULL,
|
|
`email` varchar(254) NOT NULL,
|
|
`token` varchar(128) NOT NULL,
|
|
`init_time` int(11) NOT NULL,
|
|
`expire_time` int(11) NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
|
|
|
CREATE TABLE `ticket` (
|
|
`id` bigint(20) NOT NULL,
|
|
`title` longtext NOT NULL,
|
|
`content` longtext NOT NULL,
|
|
`rootid` bigint(20) NOT NULL,
|
|
`userid` bigint(20) NOT NULL,
|
|
`datetime` bigint(20) NOT NULL,
|
|
`status` int(11) NOT NULL DEFAULT 1,
|
|
`ticket_type` varchar(24) NOT NULL DEFAULT 'technical',
|
|
`priority` varchar(8) NOT NULL DEFAULT 'medium',
|
|
`instance_id` bigint(20) DEFAULT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
CREATE TABLE `ticket_attachments` (
|
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
|
`ticket_id` bigint(20) unsigned NOT NULL,
|
|
`message_id` bigint(20) unsigned NOT NULL,
|
|
`user_id` bigint(20) unsigned NOT NULL,
|
|
`storage_key` varchar(128) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
|
|
`original_name` varchar(180) NOT NULL DEFAULT '',
|
|
`mime_type` varchar(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
|
|
`bytes` int(10) unsigned NOT NULL DEFAULT 0,
|
|
`sha256` char(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT '',
|
|
`created_at` bigint(20) unsigned NOT NULL DEFAULT 0,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `ticket_attachment_storage_key` (`storage_key`),
|
|
KEY `ticket_attachment_ticket` (`ticket_id`, `message_id`),
|
|
KEY `ticket_attachment_user` (`user_id`, `created_at`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
CREATE TABLE `user` (
|
|
`id` int(11) NOT NULL,
|
|
`user_name` varchar(128) NOT NULL,
|
|
`email` varchar(254) NOT NULL,
|
|
`last_name` varchar(80) NOT NULL DEFAULT '',
|
|
`first_name` varchar(80) NOT NULL DEFAULT '',
|
|
`phone` varchar(32) NOT NULL DEFAULT '',
|
|
`country` varchar(100) NOT NULL DEFAULT '',
|
|
`province` varchar(100) NOT NULL DEFAULT '',
|
|
`city` varchar(100) NOT NULL DEFAULT '',
|
|
`address` varchar(255) NOT NULL DEFAULT '',
|
|
`postal_code` varchar(32) NOT NULL DEFAULT '',
|
|
`pass` varchar(64) NOT NULL,
|
|
`enable` tinyint(1) NOT NULL DEFAULT 1,
|
|
`invite_num` int(11) NOT NULL DEFAULT 0,
|
|
`money` decimal(12,2) NOT NULL DEFAULT 0.00,
|
|
`ref_by` int(11) NOT NULL DEFAULT 0,
|
|
`reg_date` datetime NOT NULL,
|
|
`reg_ip` varchar(128) NOT NULL DEFAULT '',
|
|
`is_admin` tinyint(1) NOT NULL DEFAULT 0,
|
|
`im_type` int(11) NOT NULL DEFAULT 3,
|
|
`im_value` text DEFAULT NULL,
|
|
`theme` varchar(32) NOT NULL DEFAULT 'venix',
|
|
`ga_token` text DEFAULT NULL,
|
|
`ga_enable` tinyint(1) NOT NULL DEFAULT 0,
|
|
`login_verify_method` varchar(16) NOT NULL DEFAULT 'email',
|
|
`login_session_version` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
`remark` text DEFAULT NULL,
|
|
`aff_money` decimal(12,2) NOT NULL DEFAULT 0.00,
|
|
`aff_rate` int(11) NOT NULL DEFAULT 20
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
CREATE TABLE `user_surveys` (
|
|
`id` int(11) NOT NULL,
|
|
`title` varchar(255) NOT NULL DEFAULT '',
|
|
`description` text DEFAULT NULL,
|
|
`status` tinyint(1) NOT NULL DEFAULT 0,
|
|
`display_mode` varchar(16) NOT NULL DEFAULT 'card',
|
|
`target_type` varchar(16) NOT NULL DEFAULT 'all',
|
|
`target_value` varchar(255) NOT NULL DEFAULT '',
|
|
`allow_skip` tinyint(1) NOT NULL DEFAULT 1,
|
|
`priority` int(11) NOT NULL DEFAULT 0,
|
|
`start_at` int(11) NOT NULL DEFAULT 0,
|
|
`end_at` int(11) NOT NULL DEFAULT 0,
|
|
`created_at` int(11) NOT NULL DEFAULT 0,
|
|
`updated_at` int(11) NOT NULL DEFAULT 0
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `user_survey_options` (
|
|
`id` int(11) NOT NULL,
|
|
`survey_id` int(11) NOT NULL DEFAULT 0,
|
|
`question_id` int(11) NOT NULL DEFAULT 0,
|
|
`label` varchar(16) NOT NULL DEFAULT '',
|
|
`content` varchar(500) NOT NULL DEFAULT '',
|
|
`status` tinyint(1) NOT NULL DEFAULT 1,
|
|
`sort` int(11) NOT NULL DEFAULT 0,
|
|
`created_at` int(11) NOT NULL DEFAULT 0,
|
|
`updated_at` int(11) NOT NULL DEFAULT 0
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `user_survey_questions` (
|
|
`id` int(11) NOT NULL,
|
|
`survey_id` int(11) NOT NULL DEFAULT 0,
|
|
`title` varchar(255) NOT NULL DEFAULT '',
|
|
`description` text DEFAULT NULL,
|
|
`status` tinyint(1) NOT NULL DEFAULT 1,
|
|
`sort` int(11) NOT NULL DEFAULT 0,
|
|
`created_at` int(11) NOT NULL DEFAULT 0,
|
|
`updated_at` int(11) NOT NULL DEFAULT 0
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `user_survey_responses` (
|
|
`id` bigint(20) NOT NULL,
|
|
`survey_id` int(11) NOT NULL DEFAULT 0,
|
|
`question_id` int(11) NOT NULL DEFAULT 0,
|
|
`option_id` int(11) NOT NULL DEFAULT 0,
|
|
`user_id` int(11) NOT NULL DEFAULT 0,
|
|
`ip` varchar(64) NOT NULL DEFAULT '',
|
|
`user_agent` varchar(255) NOT NULL DEFAULT '',
|
|
`created_at` int(11) NOT NULL DEFAULT 0
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
ALTER TABLE `announcement`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
ALTER TABLE `checkout_apply`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `email` (`email`);
|
|
|
|
ALTER TABLE `code`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `idx_code_user_recharge_time` (`userid`,`isused`,`type`,`usedatetime`);
|
|
|
|
ALTER TABLE `configurations`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_configurations_name` (`name`);
|
|
|
|
ALTER TABLE `legal_documents`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_legal_document_slug_locale` (`slug`,`locale`),
|
|
ADD KEY `idx_legal_document_published_revision` (`published_revision_id`);
|
|
|
|
ALTER TABLE `legal_document_revisions`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_legal_document_revision` (`document_id`,`version`),
|
|
ADD KEY `idx_legal_revision_published` (`document_id`,`published_at`);
|
|
|
|
ALTER TABLE `coupon`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
ALTER TABLE `usdt_wallets`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_usdt_wallet_address` (`address`),
|
|
ADD KEY `idx_usdt_wallet_enabled_sort` (`enabled`,`sort`),
|
|
ADD KEY `idx_usdt_wallet_assignment` (`enabled`,`last_assigned_at`);
|
|
|
|
ALTER TABLE `usdt_payment_orders`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_usdt_order_no` (`order_no`),
|
|
ADD UNIQUE KEY `uniq_usdt_business_order` (`business_type`,`business_order_no`),
|
|
ADD UNIQUE KEY `uniq_usdt_paylist_id` (`paylist_id`),
|
|
ADD UNIQUE KEY `uniq_usdt_wallet_amount` (`wallet_id`,`amount_atomic`),
|
|
ADD UNIQUE KEY `uniq_usdt_txid` (`txid`),
|
|
ADD KEY `idx_usdt_user_created` (`user_id`,`created_at`),
|
|
ADD KEY `idx_usdt_status_expiry` (`status`,`expires_at`),
|
|
ADD KEY `idx_usdt_wallet_status` (`wallet_id`,`status`,`created_at`);
|
|
|
|
ALTER TABLE `usdt_chain_transactions`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_usdt_chain_event` (`event_key`),
|
|
ADD KEY `idx_usdt_chain_txid` (`txid`),
|
|
ADD KEY `idx_usdt_chain_match` (`to_address`,`amount_atomic`,`block_timestamp`),
|
|
ADD KEY `idx_usdt_chain_status` (`status`,`detected_at`),
|
|
ADD KEY `idx_usdt_chain_order` (`order_no`);
|
|
|
|
ALTER TABLE `yipay_orders`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_yipay_order_no` (`order_no`),
|
|
ADD UNIQUE KEY `uniq_yipay_gateway_trade_no` (`gateway_trade_no`),
|
|
ADD UNIQUE KEY `uniq_yipay_paylist_id` (`paylist_id`),
|
|
ADD KEY `idx_yipay_user_created` (`user_id`,`created_at`),
|
|
ADD KEY `idx_yipay_status_created` (`status`,`created_at`),
|
|
ADD KEY `idx_yipay_type_created` (`payment_type`,`created_at`);
|
|
|
|
ALTER TABLE `yipay_callback_events`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_yipay_event_key` (`event_key`),
|
|
ADD KEY `idx_yipay_event_order` (`order_no`,`received_at`),
|
|
ADD KEY `idx_yipay_event_trade` (`gateway_trade_no`,`received_at`);
|
|
|
|
ALTER TABLE `yipay_refunds`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_yipay_refund_order` (`order_no`),
|
|
ADD UNIQUE KEY `uniq_yipay_refund_trade` (`gateway_trade_no`),
|
|
ADD KEY `idx_yipay_refund_status_time` (`status`,`requested_at`),
|
|
ADD KEY `idx_yipay_refund_admin_time` (`admin_user_id`,`requested_at`);
|
|
|
|
ALTER TABLE `paytaro_orders`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_paytaro_order_no` (`order_no`),
|
|
ADD UNIQUE KEY `uniq_paytaro_gateway_trade_no` (`gateway_trade_no`),
|
|
ADD UNIQUE KEY `uniq_paytaro_paylist_id` (`paylist_id`),
|
|
ADD KEY `idx_paytaro_user_created` (`user_id`,`created_at`),
|
|
ADD KEY `idx_paytaro_status_created` (`status`,`created_at`);
|
|
|
|
ALTER TABLE `paytaro_callback_events`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_paytaro_event_key` (`event_key`),
|
|
ADD KEY `idx_paytaro_event_order` (`order_no`,`received_at`),
|
|
ADD KEY `idx_paytaro_event_trade` (`gateway_trade_no`,`received_at`);
|
|
|
|
ALTER TABLE `stripe_orders`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_stripe_order_no` (`order_no`),
|
|
ADD UNIQUE KEY `uniq_stripe_checkout_session` (`checkout_session_id`),
|
|
ADD UNIQUE KEY `uniq_stripe_payment_intent` (`payment_intent_id`),
|
|
ADD UNIQUE KEY `uniq_stripe_paylist_id` (`paylist_id`),
|
|
ADD KEY `idx_stripe_user_created` (`user_id`,`created_at`),
|
|
ADD KEY `idx_stripe_status_created` (`status`,`created_at`),
|
|
ADD KEY `idx_stripe_method_created` (`payment_method`,`created_at`);
|
|
|
|
ALTER TABLE `stripe_webhook_events`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_stripe_event_id` (`event_id`),
|
|
ADD KEY `idx_stripe_event_order` (`order_no`,`received_at`),
|
|
ADD KEY `idx_stripe_event_type` (`event_type`,`received_at`);
|
|
|
|
ALTER TABLE `email_verify`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
ALTER TABLE `login_ip`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `idx_login_user_type_time` (`userid`,`type`,`datetime`);
|
|
|
|
ALTER TABLE `payback`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
ALTER TABLE `paylist`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
ALTER TABLE `shop`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
ALTER TABLE `ss_invite_code`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `user_id` (`user_id`),
|
|
ADD KEY `idx_ss_invite_code_code` (`code`);
|
|
|
|
ALTER TABLE `ss_password_reset`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
ALTER TABLE `ticket`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `ticket_overview_root_status` (`rootid`,`status`),
|
|
ADD KEY `ticket_instance` (`instance_id`,`userid`,`rootid`);
|
|
|
|
ALTER TABLE `user`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `user_name` (`user_name`),
|
|
ADD UNIQUE KEY `uniq_user_email` (`email`),
|
|
ADD KEY `idx_user_ref_by` (`ref_by`);
|
|
|
|
ALTER TABLE `user_surveys`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `idx_status_time` (`status`,`start_at`,`end_at`),
|
|
ADD KEY `idx_priority` (`priority`,`id`);
|
|
|
|
ALTER TABLE `user_survey_options`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `idx_survey_sort` (`survey_id`,`status`,`sort`),
|
|
ADD KEY `idx_question_sort` (`question_id`,`status`,`sort`);
|
|
|
|
ALTER TABLE `user_survey_questions`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `idx_survey_sort` (`survey_id`,`status`,`sort`);
|
|
|
|
ALTER TABLE `user_survey_responses`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `uniq_survey_question_user` (`survey_id`,`question_id`,`user_id`),
|
|
ADD KEY `idx_survey_option` (`survey_id`,`option_id`),
|
|
ADD KEY `idx_user_created` (`user_id`,`created_at`);
|
|
|
|
ALTER TABLE `announcement`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `checkout_apply`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `code`
|
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `configurations`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `legal_documents`
|
|
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `legal_document_revisions`
|
|
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `coupon`
|
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `usdt_wallets`
|
|
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `usdt_payment_orders`
|
|
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `usdt_chain_transactions`
|
|
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `yipay_orders`
|
|
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `yipay_callback_events`
|
|
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `yipay_refunds`
|
|
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `paytaro_orders`
|
|
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `paytaro_callback_events`
|
|
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `stripe_orders`
|
|
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `stripe_webhook_events`
|
|
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `email_verify`
|
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `login_ip`
|
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `payback`
|
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `paylist`
|
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `shop`
|
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `ss_invite_code`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `ss_password_reset`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `ticket`
|
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `user`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `user_surveys`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `user_survey_options`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `user_survey_questions`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `user_survey_responses`
|
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|