迁移:将DB变更记录SQL文件移动到sql目录下
This commit is contained in:
12
sql/迁移记录-DB变更记录/20250104_update_cli_surgery_tenant_id.sql
Normal file
12
sql/迁移记录-DB变更记录/20250104_update_cli_surgery_tenant_id.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
-- 更新 cli_surgery 表的 tenant_id 字段
|
||||
-- 创建时间: 2025-01-04
|
||||
-- 说明: 为已存在的手术记录设置默认租户ID
|
||||
|
||||
-- 将所有 tenant_id 为 NULL 的记录设置为默认租户ID(1)
|
||||
UPDATE cli_surgery
|
||||
SET tenant_id = 1
|
||||
WHERE tenant_id IS NULL;
|
||||
|
||||
-- 添加非空约束(可选,根据业务需求决定是否执行)
|
||||
-- ALTER TABLE cli_surgery ALTER COLUMN tenant_id SET NOT NULL;
|
||||
-- ALTER TABLE cli_surgery ALTER COLUMN tenant_id SET DEFAULT 1;
|
||||
Reference in New Issue
Block a user