Files
digiserver/clear_db.py
2025-06-27 16:50:35 +03:00

14 lines
453 B
Python

import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
# Create a minimal Flask app just for clearing the database
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///instance/dashboard.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
with app.app_context():
db.reflect() # This loads all tables from the database
db.drop_all()
print("Dropped all tables successfully.")