Renamed "Salary Deduction" to "Employee Benefit"
Journal, Purchase and Purchase Return vouchers done!! Changed the column type of "date" columns from "datetime" to better fit the data.
This commit is contained in:
@ -7,6 +7,7 @@ Create Date: 2020-05-10 19:52:58.163810
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import table, column
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
@ -51,7 +52,7 @@ def upgrade():
|
||||
batch_op.alter_column('UserID', new_column_name='user_id')
|
||||
batch_op.alter_column('AttendanceType', new_column_name='attendance_type')
|
||||
batch_op.alter_column('CreationDate', new_column_name='creation_date')
|
||||
batch_op.alter_column('Date', new_column_name='date')
|
||||
batch_op.alter_column('Date', new_column_name='date', type_=sa.Date(), nullable=False)
|
||||
batch_op.alter_column('EmployeeID', new_column_name='employee_id')
|
||||
batch_op.alter_column('AttendanceID', new_column_name='id')
|
||||
batch_op.alter_column('IsValid', new_column_name='is_valid')
|
||||
@ -65,7 +66,7 @@ def upgrade():
|
||||
with op.batch_alter_table("batches") as batch_op:
|
||||
batch_op.alter_column('BatchID', new_column_name='id')
|
||||
batch_op.alter_column('Discount', new_column_name='discount')
|
||||
batch_op.alter_column('Name', new_column_name='name')
|
||||
batch_op.alter_column('Name', new_column_name='name', type_=sa.Date(), nullable=False)
|
||||
batch_op.alter_column('ProductID', new_column_name='product_id')
|
||||
batch_op.alter_column('QuantityRemaining', new_column_name='quantity_remaining')
|
||||
batch_op.alter_column('Rate', new_column_name='rate')
|
||||
@ -118,7 +119,8 @@ def upgrade():
|
||||
with op.batch_alter_table("recipes") as batch_op:
|
||||
batch_op.alter_column('recipe_id', new_column_name='id')
|
||||
|
||||
with op.batch_alter_table("salary_deductions") as batch_op:
|
||||
op.rename_table('salary_deductions', 'employee_benefit')
|
||||
with op.batch_alter_table("employee_benefit") as batch_op:
|
||||
batch_op.alter_column('SalaryDeductionID', new_column_name='id')
|
||||
batch_op.alter_column('DaysWorked', new_column_name='days_worked')
|
||||
batch_op.alter_column('EsiEmployee', new_column_name='esi_employee')
|
||||
@ -131,6 +133,23 @@ def upgrade():
|
||||
|
||||
with op.batch_alter_table("vouchers") as batch_op:
|
||||
batch_op.alter_column('VoucherID', new_column_name='id')
|
||||
batch_op.alter_column('date', type_=sa.Date(), nullable=False)
|
||||
batch_op.alter_column('reconcile_date', type_=sa.Date(), nullable=False)
|
||||
|
||||
op.rename_table('service_charges', 'incentives')
|
||||
|
||||
with op.batch_alter_table("employees") as batch_op:
|
||||
batch_op.alter_column('Designation', new_column_name='designation', nullable=False)
|
||||
batch_op.alter_column('Salary', new_column_name='salary', nullable=False)
|
||||
batch_op.alter_column('ServicePoints', new_column_name='points', nullable=False)
|
||||
batch_op.alter_column('JoiningDate', new_column_name='joining_date', type_=sa.Date(), nullable=False)
|
||||
batch_op.alter_column('LeavingDate', new_column_name='leaving_date', type_=sa.Date(), nullable=True)
|
||||
|
||||
with op.batch_alter_table("settings") as batch_op:
|
||||
batch_op.alter_column('SettingID', new_column_name='id')
|
||||
batch_op.alter_column('Name', new_column_name='name')
|
||||
batch_op.alter_column('Data', new_column_name='data')
|
||||
|
||||
|
||||
op.create_unique_constraint(op.f('uq_accounts_name'), 'accounts', ['name'])
|
||||
op.drop_constraint('accounts_name_key', 'accounts', type_='unique')
|
||||
@ -162,9 +181,23 @@ def upgrade():
|
||||
op.drop_constraint('products_Name_Units_key', 'products', type_='unique')
|
||||
op.create_unique_constraint(op.f('uq_recipe_items_recipe_id'), 'recipe_items', ['recipe_id', 'product_id'])
|
||||
op.drop_constraint('recipe_items_recipe_id_product_id_key', 'recipe_items', type_='unique')
|
||||
op.create_unique_constraint(op.f('uq_settings_Name'), 'settings', ['Name'])
|
||||
op.create_unique_constraint(op.f('uq_settings_name'), 'settings', ['name'])
|
||||
op.drop_constraint('settings_Name_key', 'settings', type_='unique')
|
||||
op.create_index(op.f('ix_vouchers_date'), 'vouchers', ['date'], unique=False)
|
||||
op.create_foreign_key('fk_incentives_journal_id_journals', 'incentives', 'journals', ['journal_id'], ['id'])
|
||||
op.create_foreign_key('fk_incentives_voucher_id_vouchers', 'incentives', 'vouchers', ['voucher_id'], ['id'])
|
||||
op.drop_constraint('service_charges_journal_id_fkey', 'incentives', type_='foreignkey')
|
||||
op.drop_constraint('service_charges_voucher_id_fkey', 'incentives', type_='foreignkey')
|
||||
op.create_foreign_key('fk_employee_benefit_journal_id_journals', 'employee_benefit', 'journals', ['journal_id'], ['id'])
|
||||
op.create_foreign_key('fk_employee_benefit_voucher_id_vouchers', 'employee_benefit', 'vouchers', ['voucher_id'], ['id'])
|
||||
op.drop_constraint('entities_salarydeductions_JournalID_fkey', 'employee_benefit', type_='foreignkey')
|
||||
op.drop_constraint('salary_deductions_VoucherID_fkey', 'employee_benefit', type_='foreignkey')
|
||||
|
||||
role = table('auth_roles', column('name', sa.String))
|
||||
op.execute(role.update().where(role.c.name == op.inline_literal('Service Charge')).values({'name': op.inline_literal('Incentive')}))
|
||||
op.execute(role.update().where(role.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')}))
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user