v1.sql 836 字节
-- 数据初始化
INSERT INTO "sys"."app"("id", "code", "name", "logo", "description", "type", "version_number", "status", "created_at", "updated_at", "deleted_at", "version", "is_del")
VALUES (1, 'AI0001', 'AI大模型应用', NULL, '高校检索文档信息,准确回答专业问题。', 'default', '1.0.0', 1, 1717050119, 1717050119, 0, 0, 0);


-- 公司应用 唯一索引
CREATE UNIQUE INDEX unique_company_app ON sys.company_app(company_id,app_id );

-- 用户部门 唯一索引
CREATE UNIQUE INDEX unique_user_department ON sys.user_department(user_id,employee_id,department_id);

-- 用户手机号 唯一索引
CREATE UNIQUE INDEX unique_user_phone ON sys.user(phone,deleted_at);

-- 职员(用户+公司)唯一索引
CREATE UNIQUE INDEX unique_employee_userid_companyid ON sys.employee(user_id,company_id,deleted_at);