scratch_chat / init_db.py
WebashalarForML's picture
Upload 178 files
330b6e4 verified
#!/usr/bin/env python3
"""Initialize the database."""
import os
os.environ['FLASK_ENV'] = 'development'
from app import create_app
from chat_agent.models.base import db
def init_database():
"""Initialize the database with tables."""
app = create_app()
with app.app_context():
# Create all tables
db.create_all()
print('Database tables created successfully')
# Verify tables exist
from sqlalchemy import inspect
inspector = inspect(db.engine)
tables = inspector.get_table_names()
print(f'Created tables: {tables}')
if __name__ == "__main__":
init_database()