- Add main application files (main.py, models.py, schemas.py, etc.) - Add routers for all features (waiting, attendance, members, etc.) - Add HTML templates for admin and user interfaces - Add migration scripts and utility files - Add Docker configuration - Add documentation files - Add .gitignore to exclude database and cache files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
from sqlalchemy import create_engine, text
|
|
from database import SQLALCHEMY_DATABASE_URL as DATABASE_URL
|
|
import os
|
|
|
|
# 데이터베이스 파일 경로 설정
|
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
DB_PATH = os.path.join(BASE_DIR, "waiting_system.db")
|
|
DATABASE_URL = f"sqlite:///{DB_PATH}"
|
|
|
|
def migrate():
|
|
engine = create_engine(DATABASE_URL)
|
|
|
|
with engine.connect() as conn:
|
|
print("Checking store_settings table...")
|
|
|
|
# closing_action 컬럼 확인
|
|
try:
|
|
result = conn.execute(text("SELECT closing_action FROM store_settings LIMIT 1"))
|
|
print("closing_action column already exists.")
|
|
except Exception:
|
|
print("Adding closing_action column...")
|
|
try:
|
|
# SQLite에서는 ALTER TABLE로 컬럼 추가 가능
|
|
conn.execute(text("ALTER TABLE store_settings ADD COLUMN closing_action VARCHAR DEFAULT 'reset'"))
|
|
conn.commit()
|
|
print("Successfully added closing_action column.")
|
|
except Exception as e:
|
|
print(f"Error adding column: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
migrate()
|