Files
sino-mci/scripts/init-data.sql

55 lines
2.4 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Sino-MCI 默认初始化数据
-- 默认登录system / superadmin / admin123
-- 注意:本脚本不包含渠道主体、渠道应用、渠道账号等敏感配置,需部署后通过页面自行配置。
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
SET UNIQUE_CHECKS = 0;
-- ----------------------------
-- 默认租户
-- ----------------------------
LOCK TABLES `mci_tenant` WRITE;
INSERT IGNORE INTO `mci_tenant` (`id`, `tenant_code`, `tenant_name`, `auth_config`, `inbound_webhook_url`, `status`, `create_time`, `update_time`, `deleted`, `ext_info`) VALUES
(1152, 'system', '系统默认租户', NULL, NULL, 1, NOW(), NOW(), 0, NULL);
UNLOCK TABLES;
-- ----------------------------
-- 默认角色
-- ----------------------------
LOCK TABLES `mci_platform_role` WRITE;
INSERT IGNORE INTO `mci_platform_role` (`id`, `role_code`, `role_name`, `permissions`, `status`, `create_time`, `update_time`, `deleted`) VALUES
(1, 'admin', '租户管理员', '["*"]', 1, NOW(), NOW(), 0),
(2, 'operator', '运营操作员', '["send:write", "channel:read", "channel:write", "record:read"]', 1, NOW(), NOW(), 0),
(3, 'viewer', '只读用户', '["record:read", "channel:read"]', 1, NOW(), NOW(), 0),
(4, 'platform_admin', '平台管理员', '["tenant:manage", "user:manage", "*"]', 1, NOW(), NOW(), 0),
(5, 'tenant_admin', '租户管理员', '["*"]', 1, NOW(), NOW(), 0);
UNLOCK TABLES;
-- ----------------------------
-- 默认全局管理员
-- ----------------------------
LOCK TABLES `mci_user` WRITE;
INSERT IGNORE INTO `mci_user` (`id`, `tenant_code`, `username`, `password`, `real_name`, `phone`, `email`, `status`, `create_time`, `update_time`, `deleted`) VALUES
(629, 'system', 'superadmin', '$2a$10$5TAes.7ToWDNNLenlNPcUeU4b6O4Nt.m9OXUpMp1wvo8JVEtCqJqu', '平台管理员', NULL, NULL, 1, NOW(), NOW(), 0);
UNLOCK TABLES;
-- ----------------------------
-- 用户角色绑定
-- ----------------------------
LOCK TABLES `mci_user_role` WRITE;
INSERT IGNORE INTO `mci_user_role` (`id`, `user_id`, `role_id`, `create_time`, `update_time`, `deleted`) VALUES
(629, 629, 4, NOW(), NOW(), 0);
UNLOCK TABLES;
-- ----------------------------
-- 重置自增,避免后续插入冲突
-- ----------------------------
ALTER TABLE `mci_tenant` AUTO_INCREMENT = 1153;
ALTER TABLE `mci_platform_role` AUTO_INCREMENT = 6;
ALTER TABLE `mci_user` AUTO_INCREMENT = 630;
ALTER TABLE `mci_user_role` AUTO_INCREMENT = 630;
SET FOREIGN_KEY_CHECKS = 1;
SET UNIQUE_CHECKS = 1;