zero-ppanel/sql/001_init.up.sql
shanshanzhong 9dacd85a89
Some checks failed
Build docker and publish / prepare (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.admin image_name:ppanel-admin name:admin]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.api image_name:ppanel-api name:api]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.node image_name:ppanel-node name:node]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.queue image_name:ppanel-queue name:queue]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.scheduler image_name:ppanel-scheduler name:scheduler]) (push) Has been cancelled
Build docker and publish / deploy (push) Has been cancelled
Build docker and publish / notify (push) Has been cancelled
初始化
2026-02-26 04:12:43 -08:00

41 lines
1.6 KiB
SQL

-- PPanel Database Schema
-- Migration: 001_init
-- Description: Initial database schema
-- ============================================================
-- User Domain
-- ============================================================
CREATE TABLE IF NOT EXISTS `user` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`email` varchar(255) DEFAULT NULL,
`telephone` varchar(32) DEFAULT NULL,
`password` varchar(255) NOT NULL DEFAULT '',
`refer_code` varchar(32) DEFAULT NULL,
`refer_id` bigint unsigned DEFAULT 0,
`avatar` varchar(512) DEFAULT '',
`balance` bigint DEFAULT 0,
`commission` bigint DEFAULT 0,
`gift_amount` bigint DEFAULT 0,
`is_admin` tinyint(1) NOT NULL DEFAULT 0,
`is_staff` tinyint(1) NOT NULL DEFAULT 0,
`enable` tinyint(1) NOT NULL DEFAULT 1,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_email` (`email`),
UNIQUE KEY `idx_telephone` (`telephone`),
UNIQUE KEY `idx_refer_code` (`refer_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- TODO: Add remaining tables
-- user_auth_methods, user_device, user_subscribe, user_balance_log,
-- user_commission_log, user_subscribe_log, user_login_log,
-- user_device_online_record, user_gift_amount_log, user_reset_subscribe_log
-- order, coupon, ticket, ticket_follow
-- payment, announcement, document
-- system, server, server_group, server_rule_group
-- subscribe, subscribe_group, subscribe_type, subscribe_application
-- ads, application, application_config, application_version
-- traffic_log, system_logs