-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_db.py
More file actions
28 lines (24 loc) · 820 Bytes
/
init_db.py
File metadata and controls
28 lines (24 loc) · 820 Bytes
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
#!/usr/bin/env python3
"""Initialize the database and create tables."""
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent / 'src'))
from storage.psql import db
from core.logger import logger
def main():
"""Initialize database tables."""
try:
logger.logger.info("Initializing database...")
db.init_db()
logger.logger.info("✓ Database initialized successfully!")
logger.logger.info("Tables created:")
logger.logger.info(" - classes")
logger.logger.info(" - quizzes")
logger.logger.info(" - quiz_class_association")
return 0
except Exception as e:
logger.logger.error(f"✗ Failed to initialize database: {str(e)}")
return 1
if __name__ == "__main__":
sys.exit(main())