forked from AsmiBhaskar/Voltonic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset_db.py
More file actions
24 lines (18 loc) · 674 Bytes
/
Copy pathreset_db.py
File metadata and controls
24 lines (18 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from app import create_app
from app.models import (
db, Building, Room, Floor, Faculty, Timetable, EnergySource,
GridStatus, EnergyLog, AutonomousLog, CancellationPattern, PowerSourceConfig
)
from app.utils.seed_data import seed_campus
app = create_app()
with app.app_context():
print("WARNING: This will delete all data in the database. Press Ctrl+C to cancel within 3 seconds.")
import time
time.sleep(3)
print("Dropping all tables...")
db.drop_all()
print("Recreating tables...")
db.create_all()
print("Seeding new data...")
seed_campus()
print("✅ Database reset complete with new naming scheme.")