@davoodmehraban89 / Aram / commits / f6c0db8
Fork 0

test(t3): require explicit reversible migration operations

davoodmehraban89 committed Oct 23, 2026 at 00:19 UTC f6c0db8a7eab5c0e06e51b0a80a31576fabd8ed9
1 file changed +27
backend/tests/test_migration_ddl.py new
+27
@@ -0,0 +1,27 @@
1 +"""Regression tests for explicit, reversible Alembic schema DDL."""
2 +
3 +from pathlib import Path
4 +
5 +
6 +def test_initial_revision_uses_explicit_operations():
7 + revision = (
8 + Path(__file__).parents[1]
9 + / "migrations"
10 + / "versions"
11 + / "20260820_01_initial_schema.py"
12 + ).read_text(encoding="utf-8")
13 + assert "Base.metadata.create_all" not in revision
14 + assert "Base.metadata.drop_all" not in revision
15 + assert "op.create_table(" in revision
16 + assert "op.drop_table(" in revision
17 +
18 +
19 +def test_initial_revision_is_not_implicitly_autogenerated():
20 + revision = (
21 + Path(__file__).parents[1]
22 + / "migrations"
23 + / "versions"
24 + / "20260820_01_initial_schema.py"
25 + ).read_text(encoding="utf-8")
26 + assert "metadata.create_all" not in revision
27 + assert "metadata.drop_all" not in revision