28 lines
860 B
Python
28 lines
860 B
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
|
|
from app.db.migrations import migrate_database
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description="Upgrade the Multi Seal Mail database schema")
|
|
parser.add_argument(
|
|
"--no-reconcile-legacy-schema",
|
|
action="store_true",
|
|
help="Disable repair of the known create_all/Alembic development schema drift",
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
result = migrate_database(reconcile_legacy_schema=not args.no_reconcile_legacy_schema)
|
|
if result.reconciled_revision:
|
|
print(
|
|
"Reconciled legacy database marker "
|
|
f"from {result.previous_revision or 'unversioned'} to {result.reconciled_revision}."
|
|
)
|
|
print(f"Database schema is at revision {result.current_revision or 'unknown'}.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|