adde user role to DB
This commit is contained in:
parent
acd25c2e44
commit
7b5a3f9eb9
1 changed files with 2 additions and 0 deletions
|
@ -30,8 +30,10 @@ def upgrade():
|
|||
|
||||
# Insert default role "admin" as ID 1
|
||||
op.execute(sa.insert(role_table).values(id=1,name="admin"))
|
||||
op.execute(sa.insert(role_table).values(id=2,name="user"))
|
||||
# Set role_id 1 to all current "admin" users
|
||||
op.execute("UPDATE app_role SET role_id = 1 WHERE role = 'admin'")
|
||||
op.execute("UPDATE app_role SET role_id = 2 WHERE role = 'user'")
|
||||
|
||||
# Drop old column
|
||||
op.drop_column("app_role", "role")
|
||||
|
|
Loading…
Reference in a new issue