Spaces:
Sleeping
Sleeping
Delete reset_alembic.py with huggingface_hub
Browse files- reset_alembic.py +0 -24
reset_alembic.py
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
from sqlalchemy import create_engine, text
|
| 3 |
-
from dotenv import load_dotenv
|
| 4 |
-
|
| 5 |
-
load_dotenv()
|
| 6 |
-
db_url = os.getenv('DATABASE_URL')
|
| 7 |
-
print(f"Connecting to: {db_url.split('@')[-1] if db_url else 'None'}")
|
| 8 |
-
|
| 9 |
-
engine = create_engine(db_url)
|
| 10 |
-
|
| 11 |
-
try:
|
| 12 |
-
with engine.connect() as conn:
|
| 13 |
-
# Check current version
|
| 14 |
-
result = conn.execute(text("SELECT version_num FROM alembic_version"))
|
| 15 |
-
version = result.scalar()
|
| 16 |
-
print(f"Current version in DB: {version}")
|
| 17 |
-
|
| 18 |
-
# Reset to last good version
|
| 19 |
-
target_version = '96c49eb28637'
|
| 20 |
-
conn.execute(text(f"UPDATE alembic_version SET version_num = '{target_version}'"))
|
| 21 |
-
conn.commit()
|
| 22 |
-
print(f"Successfully reset version to: {target_version}")
|
| 23 |
-
except Exception as e:
|
| 24 |
-
print(f"FAILED to reset version: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|