41 lines
1.6 KiB
SQL
41 lines
1.6 KiB
SQL
|
|
-- MySQL 首次启动初始化:建两个业务库 + 运营端超级管理员
|
||
|
|
-- 仅在容器数据目录为空时执行一次(/docker-entrypoint-initdb.d/ 机制)
|
||
|
|
|
||
|
|
CREATE DATABASE IF NOT EXISTS opc CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||
|
|
CREATE DATABASE IF NOT EXISTS opc_compute CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||
|
|
|
||
|
|
GRANT ALL PRIVILEGES ON opc.* TO 'opc'@'%';
|
||
|
|
GRANT ALL PRIVILEGES ON opc_compute.* TO 'opc'@'%';
|
||
|
|
FLUSH PRIVILEGES;
|
||
|
|
|
||
|
|
-- 运营端超级管理员:手机号 17637177199(短信验证码登录,无密码),昵称 Pine
|
||
|
|
INSERT INTO opc.users
|
||
|
|
(id, username, nickname, password_hash, password_salt,
|
||
|
|
wx_openid, wx_unionid, wx_mini_openid, phone, email,
|
||
|
|
account, company, room, avatar, company_avatar,
|
||
|
|
gender, birthday, id_card, ethnicity, grad_school_major, grad_time,
|
||
|
|
role, sub_role, status, token_version, source, auth_type,
|
||
|
|
register_ip, last_login_ip, last_login_at,
|
||
|
|
compute_provisioned, compute_username, compute_quota, compute_used_quota,
|
||
|
|
certification_status, certification_time, affiliation, park_id, park_name,
|
||
|
|
account_type, opc_status, topics, created_at, updated_at)
|
||
|
|
VALUES
|
||
|
|
('u_pine_admin', '17637177199', 'Pine',
|
||
|
|
'', '',
|
||
|
|
'', '', '', '17637177199', '',
|
||
|
|
'', '', '', '', '',
|
||
|
|
'unknown', '', '', '', '', '',
|
||
|
|
'operator', 'op_super_admin', 'active', 0, 'seed', 'phone',
|
||
|
|
'', '', '',
|
||
|
|
0, '17637177199', 0, 0,
|
||
|
|
'', '', '', '', '',
|
||
|
|
'', '', '', '', '')
|
||
|
|
ON DUPLICATE KEY UPDATE
|
||
|
|
phone = '17637177199',
|
||
|
|
role = 'operator',
|
||
|
|
sub_role = 'op_super_admin',
|
||
|
|
status = 'active',
|
||
|
|
nickname = VALUES(nickname),
|
||
|
|
compute_username = VALUES(compute_username);
|
||
|
|
|