feat(db): RLS 策略迁移 — 80 张 tenant_id 表启用行级安全

- 所有含 tenant_id 的表(基础 34 + 健康 28 + 其他 18)启用 RLS
- 策略:未设置 app.current_tenant_id 时允许全部,设置后按 tenant_id 过滤
- down 方法完整回退(DROP POLICY + DISABLE ROW LEVEL SECURITY)
This commit is contained in:
iven
2026-04-27 18:40:07 +08:00
parent 3197dde33c
commit b7b9f50d00
2 changed files with 146 additions and 0 deletions

View File

@@ -85,6 +85,7 @@ mod m20260427_000082_seed_ai_prompts;
mod m20260427_000083_create_follow_up_template;
mod m20260427_000084_domain_events_cleanup;
mod m20260427_000085_processed_events;
mod m20260427_000086_enable_rls_all_tables;
pub struct Migrator;
@@ -177,6 +178,7 @@ impl MigratorTrait for Migrator {
Box::new(m20260427_000083_create_follow_up_template::Migration),
Box::new(m20260427_000084_domain_events_cleanup::Migration),
Box::new(m20260427_000085_processed_events::Migration),
Box::new(m20260427_000086_enable_rls_all_tables::Migration),
]
}
}