Spaces:
Runtime error
Runtime error
File size: 687 Bytes
9268438 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | """
Database initialization script for the Todo Application.
This script creates all necessary tables and indexes for the application.
"""
import asyncio
from sqlmodel import SQLModel
from models import User, Task
from db import engine
def create_db_and_tables():
"""
Creates all database tables based on SQLModel definitions.
"""
print("Creating database tables...")
# Create all tables
SQLModel.metadata.create_all(engine)
print("Database tables created successfully!")
print("- Users table")
print("- Tasks table")
print("- Indexes: tasks.user_id, tasks.completed, tasks.created_at")
if __name__ == "__main__":
create_db_and_tables() |