19 lines
457 B
Python
19 lines
457 B
Python
from pathlib import Path
|
|
|
|
from adapters.postgres import PostgresTraceRepository
|
|
from config import get_settings
|
|
|
|
|
|
def main() -> None:
|
|
dsn = get_settings().postgres_dsn
|
|
migrations_dir = Path(__file__).parent / "migrations"
|
|
|
|
repository = PostgresTraceRepository(dsn)
|
|
for migration in sorted(migrations_dir.glob("*.sql")):
|
|
repository.migrate(migration)
|
|
print(f"Applied {migration.name}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|