We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5031f31 commit 4a996d3Copy full SHA for 4a996d3
app/migrate_add_admin.py
@@ -0,0 +1,14 @@
1
+from app.main import create_app
2
+from app.models import db, User
3
+
4
+app = create_app()
5
6
+with app.app_context():
7
+ # Add is_admin column to existing users
8
+ users = User.query.all()
9
+ for user in users:
10
+ if not hasattr(user, 'is_admin'):
11
+ user.is_admin = user.username == 'admin' # Make 'admin' user an admin
12
13
+ db.session.commit()
14
+ print("Migration completed. Admin flags added to users.")
0 commit comments