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:
1 parent
a0f27fe364
commit
98edca5f60
35 files changed
+977
-894
No files matched your search
@@ -1,54 +0,0 @@
|
||||
"""test
|
||||
|
||||
Revision ID: 03ea3e9cb1e5
|
||||
Revises: 5498fc4bf58d
|
||||
Create Date: 2020-05-14 21:25:08.945280
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '03ea3e9cb1e5'
|
||||
down_revision = '5498fc4bf58d'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("attendances") as batch_op:
|
||||
batch_op.alter_column('date', type_=sa.Date(), nullable=False)
|
||||
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_settings_name'), 'settings', ['name'])
|
||||
op.drop_constraint('uq_settings_Name', 'settings', type_='unique')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("attendances") as batch_op:
|
||||
batch_op.alter_column('date', type_=sa.DateTime())
|
||||
with op.batch_alter_table("employees") as batch_op:
|
||||
batch_op.alter_column('designation', new_column_name='Designation', nullable=True)
|
||||
batch_op.alter_column('salary', new_column_name='Salary', nullable=True)
|
||||
batch_op.alter_column('points', new_column_name='ServicePoints', nullable=True)
|
||||
batch_op.alter_column('joining_date', new_column_name='JoiningDate', type_=sa.DateTime(), nullable=True)
|
||||
batch_op.alter_column('leaving_date', new_column_name='LeavingDate', type_=sa.DateTime(), nullable=True)
|
||||
with op.batch_alter_table("settings") as batch_op:
|
||||
batch_op.alter_column('id', new_column_name='SettingID')
|
||||
batch_op.alter_column('name', new_column_name='Name')
|
||||
batch_op.alter_column('data', new_column_name='Data')
|
||||
op.create_unique_constraint('uq_settings_Name', 'settings', ['name'])
|
||||
op.drop_constraint(op.f('uq_settings_name'), 'settings', type_='unique')
|
||||
# ### end Alembic commands ###
|
||||
@@ -1,46 +0,0 @@
|
||||
"""Rename Service Charge to Incentive
|
||||
|
||||
Revision ID: 5498fc4bf58d
|
||||
Revises: eed0b382c287
|
||||
Create Date: 2020-05-12 16:39:12.157447
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.sql import table, column
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5498fc4bf58d'
|
||||
down_revision = 'eed0b382c287'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('service_charges_journal_id_fkey', 'service_charges', type_='foreignkey')
|
||||
op.drop_constraint('service_charges_voucher_id_fkey', 'service_charges', type_='foreignkey')
|
||||
op.rename_table('service_charges', 'incentives')
|
||||
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'])
|
||||
|
||||
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')}))
|
||||
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 ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('fk_incentives_journal_id_journals', 'incentives', type_='foreignkey')
|
||||
op.drop_constraint('fk_incentives_voucher_id_vouchers', 'incentives', type_='foreignkey')
|
||||
op.rename_table('incentives', 'service_charges')
|
||||
op.create_foreign_key('service_charges_journal_id_fkey', 'service_charges', 'journals', ['journal_id'], ['journals.id'])
|
||||
op.create_foreign_key('service_charges_voucher_id_fkey', 'service_charges', 'vouchers', ['voucher_id'], ['vouchers.id'])
|
||||
|
||||
role = table('auth_roles', column('name', sa.String))
|
||||
op.execute(role.update().where(role.c.name == op.inline_literal('Incentive')).values({'name': op.inline_literal('Service Charge')}))
|
||||
account = table('accounts', column('name', sa.String))
|
||||
op.execute(account.update().where(account.c.name == op.inline_literal('Incentives')).values({'name': op.inline_literal('Service Charges')}))
|
||||
# ### end Alembic commands ###
|
||||
@@ -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