initial commit
This commit is contained in:
18
backend/migrate_db_v3.py
Normal file
18
backend/migrate_db_v3.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from sqlalchemy import create_engine, text
|
||||
import os
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
DB_URL = f"sqlite:///{os.path.join(BASE_DIR, 'kis_stock.db')}"
|
||||
|
||||
engine = create_engine(DB_URL)
|
||||
|
||||
def migrate():
|
||||
with engine.connect() as conn:
|
||||
try:
|
||||
conn.execute(text("ALTER TABLE watchlist ADD COLUMN is_monitoring BOOLEAN DEFAULT 1"))
|
||||
print("Added is_monitoring column to watchlist")
|
||||
except Exception as e:
|
||||
print(f"Column might already exist: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
migrate()
|
||||
Reference in New Issue
Block a user