Co-Authored-By: OpenAI Codex <codex@openai.com> Co-authored-by: Cursor <cursoragent@cursor.com>
14 lines
565 B
Plaintext
14 lines
565 B
Plaintext
---
|
||
description: 数据库规则:schema 变更、RLS 双 schema、文档同步和验证 SQL。
|
||
globs: db/**,docs/database/**
|
||
alwaysApply: false
|
||
---
|
||
|
||
# 数据库规则
|
||
|
||
- 任何 PostgreSQL schema/迁移/DDL/ORM 结构变更必须同步 `docs/database/`。
|
||
- 新建 DWS/DWD RLS 视图必须同时创建原 schema 和 `app` schema 视图。
|
||
- 回滚需逆序 DROP/ALTER,并提供至少 3 条验证 SQL。
|
||
- 默认使用 `TEST_DB_DSN` / `TEST_APP_DB_DSN`,禁止连正式库。
|
||
- DDL 基线变更后运行 `tools/db/gen_consolidated_ddl.py` 并同步权威 DDL。
|