Merged payment and receipt routes and permissions into journal as they were not really needed.
This commit is contained in:
@ -7,7 +7,8 @@ Create Date: 2020-05-10 19:52:58.163810
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import table, column
|
||||
from sqlalchemy import table, column, select
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'eed0b382c287'
|
||||
@ -192,11 +193,25 @@ def upgrade():
|
||||
op.drop_constraint('entities_salarydeductions_JournalID_fkey', 'employee_benefit', type_='foreignkey')
|
||||
op.drop_constraint('salary_deductions_VoucherID_fkey', 'employee_benefit', type_='foreignkey')
|
||||
|
||||
permission = table('auth_permissions', column('name', sa.String))
|
||||
permission = table('auth_permissions', column('id', postgresql.UUID()), column('name', sa.String))
|
||||
op.execute(permission.update().where(permission.c.name == op.inline_literal('Service Charge')).values({'name': op.inline_literal('Incentive')}))
|
||||
op.execute(permission.update().where(permission.c.name == op.inline_literal('Salary Deduction')).values({'name': op.inline_literal('Employee Benefit')}))
|
||||
account = table('accounts', column('name', sa.String))
|
||||
op.execute(account.update().where(account.c.name == op.inline_literal('Service Charges')).values({'name': op.inline_literal('Incentives')}))
|
||||
# Remove unneeded Payment and Receipt permissions
|
||||
permission = table('auth_permissions', column('id', postgresql.UUID()), column('name', sa.String))
|
||||
role_permission = table('role_permissions', column('permission_id', postgresql.UUID()), column('role_id', postgresql.UUID()))
|
||||
op.execute(
|
||||
role_permission.delete().where(
|
||||
role_permission.c.permission_id.in_(select([permission.c.id], permission.c.name.in_(['Payment', 'Receipt'])))
|
||||
)
|
||||
)
|
||||
op.execute(
|
||||
permission.delete().where(
|
||||
permission.c.name.in_(['Payment', 'Receipt'])
|
||||
)
|
||||
)
|
||||
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user