refactor(data): baseline 迁移改为完整幂等建库脚本,放宽 checksum 校验

- baseline migration 从占位 SELECT 1 替换为完整的幂等 DDL,支持全新数据库从零建库
- 迁移校验从 checksum 严格报错改为 warn-only,仅按版本匹配
- 移除过时的 schema 导出文件(README/TSV)
- Dockerfile 移除 :nonroot 标签,docker-compose 移除 user 指令,统一以默认用户运行
This commit is contained in:
fawney19
2026-04-11 14:31:28 +08:00
parent 8cd2c4d5bd
commit aa5761954e
7 changed files with 4596 additions and 911 deletions

View File

@@ -1,22 +0,0 @@
# Public Schema Snapshot
This directory stores a searchable snapshot of the current local Postgres `public` schema.
Purpose:
- Make legacy Python-era columns discoverable without reverse-tracing every migration.
- Keep `migrations/20260403000000_baseline.sql` as a no-op handoff point instead of stuffing the full legacy schema into a fake baseline.
Files:
- `current-public-tables.tsv`: `table_name`, `column_count`
- `current-public-columns.tsv`: `table_name`, `ordinal_position`, `column_name`, `data_type`, `is_nullable`, `column_default`, `column_comment`
Source:
- Generated from the local `aether` Postgres database on `2026-04-10`.
Refresh commands:
```bash
docker compose exec -T postgres psql -U postgres -d aether -At -F $'\t' -c "SELECT table_name, COUNT(*) FROM information_schema.columns WHERE table_schema = 'public' GROUP BY table_name ORDER BY table_name;"
docker compose exec -T postgres psql -U postgres -d aether -At -F $'\t' -c "SELECT c.table_name, c.ordinal_position, c.column_name, c.data_type, c.is_nullable, COALESCE(c.column_default, ''), COALESCE(pg_catalog.col_description((quote_ident(c.table_schema) || '.' || quote_ident(c.table_name))::regclass::oid, c.ordinal_position), '') FROM information_schema.columns c WHERE c.table_schema = 'public' ORDER BY c.table_name, c.ordinal_position;"
```
This snapshot is documentation only. Runtime code must still treat the actual database as source of truth.