[30388f42] Infrastructure Hardening: Repaired CE/Connector DB schema, fixed frontend styling build, implemented robust echo shield in worker v2.1.1, and integrated Lead Engine into gateway.
This commit is contained in:
31
company-explorer/backend/scripts/migrate_opener.py
Normal file
31
company-explorer/backend/scripts/migrate_opener.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from sqlalchemy import create_engine, text
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add backend path
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), "../../"))
|
||||
from backend.config import settings
|
||||
|
||||
def migrate():
|
||||
engine = create_engine(settings.DATABASE_URL)
|
||||
with engine.connect() as conn:
|
||||
try:
|
||||
# Check if column exists
|
||||
print("Checking schema...")
|
||||
# SQLite specific pragma
|
||||
result = conn.execute(text("PRAGMA table_info(companies)"))
|
||||
columns = [row[1] for row in result.fetchall()]
|
||||
|
||||
if "ai_opener" in columns:
|
||||
print("Column 'ai_opener' already exists. Skipping.")
|
||||
else:
|
||||
print("Adding column 'ai_opener' to 'companies' table...")
|
||||
conn.execute(text("ALTER TABLE companies ADD COLUMN ai_opener TEXT"))
|
||||
conn.commit()
|
||||
print("✅ Migration successful.")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Migration failed: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
migrate()
|
||||
Reference in New Issue
Block a user