Checked the alembic migration. It is fine
Fixed errors in user / roles / etc. mostly introduced due to the renaming of tables
This commit is contained in:
@ -27,10 +27,12 @@ def upgrade():
|
||||
op.rename_table('auth_roles', 'auth_permissions')
|
||||
with op.batch_alter_table("auth_permissions") as batch_op:
|
||||
batch_op.alter_column('RoleID', new_column_name='id')
|
||||
batch_op.alter_column('Name', new_column_name='name')
|
||||
|
||||
op.rename_table('auth_groups', 'auth_roles')
|
||||
with op.batch_alter_table("auth_roles") as batch_op:
|
||||
batch_op.alter_column('GroupID', new_column_name='id')
|
||||
batch_op.alter_column('Name', new_column_name='name')
|
||||
|
||||
op.rename_table('auth_rolegroups', 'role_permissions')
|
||||
with op.batch_alter_table("role_permissions") as batch_op:
|
||||
@ -138,14 +140,10 @@ def upgrade():
|
||||
op.drop_constraint('auth_clients_Name_key', 'auth_clients', type_='unique')
|
||||
op.create_unique_constraint(op.f('uq_auth_login_history_user_id'), 'auth_login_history', ['user_id', 'client_id', 'date'])
|
||||
op.drop_constraint('auth_login_history_user_id_client_id_date_key', 'auth_login_history', type_='unique')
|
||||
op.add_column('auth_permissions', sa.Column('name', sa.Unicode(length=255), nullable=True))
|
||||
op.create_unique_constraint(op.f('uq_auth_permissions_name'), 'auth_permissions', ['name'])
|
||||
op.drop_constraint('auth_roles_Name_key', 'auth_permissions', type_='unique')
|
||||
op.drop_column('auth_permissions', 'Name')
|
||||
op.add_column('auth_roles', sa.Column('name', sa.Unicode(length=255), nullable=True))
|
||||
op.create_unique_constraint(op.f('uq_auth_roles_name'), 'auth_roles', ['name'])
|
||||
op.drop_constraint('auth_groups_Name_key', 'auth_roles', type_='unique')
|
||||
op.drop_column('auth_roles', 'Name')
|
||||
op.create_unique_constraint(op.f('uq_auth_users_username'), 'auth_users', ['username'])
|
||||
op.drop_constraint('auth_users_Name_key', 'auth_users', type_='unique')
|
||||
op.create_unique_constraint(op.f('uq_cost_centres_name'), 'cost_centres', ['name'])
|
||||
|
||||
Reference in New Issue
Block a user