-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.py
38 lines (36 loc) · 1.01 KB
/
db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def create() -> None :
try :
from app import db
from app.models.user import User
from app.models.link import Link
db.create_all()
print("✓ Database creation SUCCESSFUL.")
except Exception as e :
print("✕ Database creation FAILED ! :")
print(f"↪ {e}")
exit(0)
exit(1)
def drop() -> None :
try :
from app import db
db.drop_all()
print("✓ Database deletion SUCCESSFUL.")
except Exception as e :
print("✕ Database deletion FAILED ! :")
print(f"↪ {e}")
exit(0)
exit(1)
def reset() -> None :
try :
from app import db
db.drop_all()
print("✓ Database deletion SUCCESSFUL.")
from app.models.user import User
from app.models.link import Link
db.create_all()
print("✓ Database creation SUCCESSFUL.")
except Exception as e :
print("✕ Database reset FAILED ! :")
print(f"↪ {e}")
exit(0)
exit(1)