bmc_hub/apply_migration_150.py

23 lines
564 B
Python
Raw Normal View History

import psycopg2
from app.core.config import settings
def apply_migration():
conn = psycopg2.connect(settings.DATABASE_URL)
conn.autocommit = True
cur = conn.cursor()
try:
with open('migrations/150_sag_tidsforbrug_v1.sql', 'r') as f:
sql = f.read()
cur.execute(sql)
print("Migration 150 applied successfully.")
except Exception as e:
print(f"Error applying migration 150: {e}")
finally:
cur.close()
conn.close()
if __name__ == "__main__":
apply_migration()