final upload
This commit is contained in:
13
clear_db.py
13
clear_db.py
@@ -1,7 +1,14 @@
|
||||
import os
|
||||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
# drop_user_table.py
|
||||
from app import app, db
|
||||
# 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.")
|
||||
print("Dropped all tables successfully.")
|
||||
Reference in New Issue
Block a user