feat(phase5): integracion auth hibrida, email dinamico y moodle 4.1 backend con tolerancia a fallos
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
Migration script to create moodle_sync_tasks table if it doesn't exist.
|
||||
Supports both SQLite and PostgreSQL.
|
||||
"""
|
||||
from app import create_app, db
|
||||
from app.models.sync_task import MoodleSyncTask
|
||||
from sqlalchemy import inspect
|
||||
|
||||
def run_migration():
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
engine = db.engine
|
||||
print(f"Connecting to database using engine: {engine.name}")
|
||||
|
||||
# db.create_all() creates any missing tables including moodle_sync_tasks
|
||||
db.create_all()
|
||||
print("db.create_all() executed successfully. Checking table existence...")
|
||||
|
||||
inspector = inspect(engine)
|
||||
tables = inspector.get_table_names()
|
||||
if 'moodle_sync_tasks' in tables:
|
||||
print("SUCCESS: 'moodle_sync_tasks' table exists and is ready.")
|
||||
cols = [c['name'] for c in inspector.get_columns('moodle_sync_tasks')]
|
||||
print(f"Columns in moodle_sync_tasks: {cols}")
|
||||
else:
|
||||
print("ERROR: 'moodle_sync_tasks' table was not created.")
|
||||
|
||||
if __name__ == '__main__':
|
||||
run_migration()
|
||||
Reference in New Issue
Block a user