feat(sync): full code sync from release
This commit is contained in:
@@ -12,6 +12,26 @@ Format: `NNN_description.sql`
|
||||
|
||||
Example: `017_add_gemini_tier_id.sql`
|
||||
|
||||
### `_notx.sql` 命名与执行语义(并发索引专用)
|
||||
|
||||
当迁移包含 `CREATE INDEX CONCURRENTLY` 或 `DROP INDEX CONCURRENTLY` 时,必须使用 `_notx.sql` 后缀,例如:
|
||||
|
||||
- `062_add_accounts_priority_indexes_notx.sql`
|
||||
- `063_drop_legacy_indexes_notx.sql`
|
||||
|
||||
运行规则:
|
||||
|
||||
1. `*.sql`(不带 `_notx`)按事务执行。
|
||||
2. `*_notx.sql` 按非事务执行,不会包裹在 `BEGIN/COMMIT` 中。
|
||||
3. `*_notx.sql` 仅允许并发索引语句,不允许混入事务控制语句或其他 DDL/DML。
|
||||
|
||||
幂等要求(必须):
|
||||
|
||||
- 创建索引:`CREATE INDEX CONCURRENTLY IF NOT EXISTS ...`
|
||||
- 删除索引:`DROP INDEX CONCURRENTLY IF EXISTS ...`
|
||||
|
||||
这样可以保证灾备重放、重复执行时不会因对象已存在/不存在而失败。
|
||||
|
||||
## Migration File Structure
|
||||
|
||||
```sql
|
||||
|
||||
Reference in New Issue
Block a user