diff --git a/migrations/versions/5f462d2d9d25_convert_role_column_to_table.py b/migrations/versions/5f462d2d9d25_convert_role_column_to_table.py index 53a8a1d..bfc7843 100644 --- a/migrations/versions/5f462d2d9d25_convert_role_column_to_table.py +++ b/migrations/versions/5f462d2d9d25_convert_role_column_to_table.py @@ -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")