-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage_db.py
46 lines (32 loc) · 1000 Bytes
/
manage_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
39
40
41
42
43
44
45
46
import tierlist
from tierlist import create_app, db
from tierlist.models import User, Tierlist, Comp, Post
app = create_app()
def main():
# create_db()
manage()
def create_db():
with app.app_context():
db.create_all()
admin = User(username="Admin", email="Niklasarens1@gmx.de",
is_admin=True, password="xxx")
new_tierlist = Tierlist(author=admin)
db.session.add(admin)
db.session.add(new_tierlist)
db.session.commit()
def manage():
with app.app_context():
# user_1 = User.query.first()
# list_1 = Tierlist.query.first()
# for user in User.query.all():
# user.is_admin = False
# post = Post.query.all()
# db.session.commit()
# user = User.query.all()
# list_1.name = "Live"
# print(list_1)
# db.session.commit()
print(Tierlist.query.all())
print(Comp.query.all())
if __name__ == '__main__':
main()