Attendance Done!!

Changed the datatype of dates in attendance and employee to date from datetime
this might bork things in other places
This commit is contained in:
tanshu
2020-05-14 21:49:22 +05:30
parent 0a79b1acbb
commit bd05e6bb17
17 changed files with 201 additions and 108 deletions

View File

@ -50,6 +50,7 @@ def run_migrations_offline():
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
compare_type=True
)
with context.begin_transaction():
@ -73,7 +74,8 @@ def run_migrations_online():
with connectable.connect() as connection:
context.configure(
connection=connection, target_metadata=target_metadata
connection=connection, target_metadata=target_metadata,
compare_type=True
)
with context.begin_transaction():

View File

@ -0,0 +1,54 @@
"""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 ###