Implement document reconciliation v2
This commit is contained in:
@@ -39,7 +39,8 @@ def main() -> int:
|
||||
parser.add_argument("--dry-run", action="store_true", help="List pending migrations without applying them.")
|
||||
args = parser.parse_args()
|
||||
|
||||
files = sorted(MIGRATIONS_DIR.glob("*.sql"))
|
||||
# Down migrations are operator-invoked rollback artefacts, never pending ups.
|
||||
files = sorted(path for path in MIGRATIONS_DIR.glob("*.sql") if not path.stem.endswith("_down"))
|
||||
if not files:
|
||||
print("No migrations found.")
|
||||
return 0
|
||||
@@ -69,6 +70,14 @@ def main() -> int:
|
||||
return 0
|
||||
|
||||
for version, path in pending:
|
||||
if version == "007":
|
||||
from scripts.preflight_document_reconciliation_v2 import run_preflight
|
||||
diagnostics = run_preflight(conn)
|
||||
if diagnostics["blockers"]:
|
||||
print("Migration 007 preflight failed:")
|
||||
for blocker in diagnostics["blockers"]:
|
||||
print(f"- {blocker}")
|
||||
return 2
|
||||
sql = path.read_text()
|
||||
print(f"Applying {path.name}...")
|
||||
conn.execute(text(sql))
|
||||
|
||||
Reference in New Issue
Block a user