04/16 Upload codebase

This commit is contained in:
2026-04-16 08:27:07 -04:00
parent 91be5c1f5c
commit 457016b8d4
43 changed files with 6241 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
"""
reset_db.py — Drop and recreate all tables from the current models.
WARNING: This deletes all existing data. Development use only.
Run with: python reset_db.py
"""
from app import create_app, db
app = create_app('development')
with app.app_context():
print('Dropping all tables...')
with db.engine.connect() as conn:
conn.execute(db.text('SET FOREIGN_KEY_CHECKS=0'))
for table in reversed(db.metadata.sorted_tables):
print(f' dropping {table.name}')
conn.execute(db.text(f'DROP TABLE IF EXISTS `{table.name}`'))
conn.execute(db.text('SET FOREIGN_KEY_CHECKS=1'))
conn.commit()
print('Creating all tables...')
db.create_all()
print('Done. All tables recreated.')