17 lines
590 B
Python
17 lines
590 B
Python
import sys
|
|
from pathlib import Path
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
|
|
|
from app import create_app
|
|
from models import db, Course, Student, StudentAccount
|
|
|
|
app = create_app()
|
|
with app.app_context():
|
|
for model in (Course, Student, StudentAccount):
|
|
t = model.__tablename__
|
|
rows = db.session.execute(db.text(f'SHOW COLUMNS FROM `{t}`')).fetchall()
|
|
existing = {r[0] for r in rows}
|
|
model_cols = {c.name for c in model.__table__.columns}
|
|
missing = model_cols - existing
|
|
print(t, 'missing:', missing)
|