fix migration
This commit is contained in:
@@ -29,12 +29,19 @@ def _add_column_if_missing(table: str, column: str, ddl: str) -> None:
|
||||
|
||||
|
||||
def _ensure_schema_migrations_table() -> None:
|
||||
from app.db.dialect import is_postgresql
|
||||
|
||||
applied_type = (
|
||||
"TIMESTAMP DEFAULT CURRENT_TIMESTAMP"
|
||||
if is_postgresql(engine)
|
||||
else "DATETIME DEFAULT CURRENT_TIMESTAMP"
|
||||
)
|
||||
with engine.begin() as conn:
|
||||
conn.execute(
|
||||
text(
|
||||
"CREATE TABLE IF NOT EXISTS _schema_migrations ("
|
||||
"name TEXT PRIMARY KEY, "
|
||||
"applied_at DATETIME DEFAULT CURRENT_TIMESTAMP)"
|
||||
f"applied_at {applied_type})"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user