Alembic updated to current schema
This commit is contained in:
parent
3cd7ff11f6
commit
899b5f31ab
alembic/versions
174
alembic/versions/eed0b382c287_lowercase_fastapi.py
Normal file
174
alembic/versions/eed0b382c287_lowercase_fastapi.py
Normal file
@ -0,0 +1,174 @@
|
||||
"""my test
|
||||
|
||||
Revision ID: eed0b382c287
|
||||
Revises: 0bf3d70ee7de
|
||||
Create Date: 2020-05-10 19:52:58.163810
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'eed0b382c287'
|
||||
down_revision = '0bf3d70ee7de'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('msg_subscribers')
|
||||
op.drop_table('msg_posts')
|
||||
op.drop_table('msg_threadtags')
|
||||
op.drop_table('msg_threads')
|
||||
op.drop_table('msg_tags')
|
||||
|
||||
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')
|
||||
|
||||
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')
|
||||
|
||||
op.rename_table('auth_rolegroups', 'role_permissions')
|
||||
with op.batch_alter_table("role_permissions") as batch_op:
|
||||
batch_op.alter_column('RoleGroupID', new_column_name='id')
|
||||
batch_op.alter_column('RoleID', new_column_name='permission_id')
|
||||
batch_op.alter_column('GroupID', new_column_name='role_id')
|
||||
|
||||
op.rename_table('auth_usergroups', 'user_roles')
|
||||
with op.batch_alter_table("user_roles") as batch_op:
|
||||
batch_op.alter_column('UserGroupID', new_column_name='id')
|
||||
batch_op.alter_column('UserID', new_column_name='user_id')
|
||||
batch_op.alter_column('GroupID', new_column_name='role_id')
|
||||
|
||||
with op.batch_alter_table("attendances") as batch_op:
|
||||
batch_op.alter_column('Amount', new_column_name='amount')
|
||||
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('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')
|
||||
|
||||
with op.batch_alter_table("auth_users") as batch_op:
|
||||
batch_op.alter_column('UserID', new_column_name='id')
|
||||
batch_op.alter_column('Name', new_column_name='username')
|
||||
batch_op.alter_column('Password', new_column_name='password')
|
||||
batch_op.alter_column('LockedOut', new_column_name='disabled')
|
||||
|
||||
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('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')
|
||||
batch_op.alter_column('Tax', new_column_name='tax')
|
||||
|
||||
with op.batch_alter_table("cost_centres") as batch_op:
|
||||
batch_op.alter_column('CostCentreID', new_column_name='id')
|
||||
batch_op.alter_column('Name', new_column_name='name')
|
||||
batch_op.alter_column('IsFixture', new_column_name='is_fixture')
|
||||
|
||||
with op.batch_alter_table("product_groups") as batch_op:
|
||||
batch_op.alter_column('ProductGroupID', new_column_name='id')
|
||||
batch_op.alter_column('Name', new_column_name='name')
|
||||
batch_op.alter_column('IsFixture', new_column_name='is_fixture')
|
||||
|
||||
with op.batch_alter_table("inventories") as batch_op:
|
||||
batch_op.alter_column('InventoryID', new_column_name='id')
|
||||
batch_op.alter_column('BatchID', new_column_name='batch_id')
|
||||
batch_op.alter_column('Discount', new_column_name='discount')
|
||||
batch_op.alter_column('ProductID', new_column_name='product_id')
|
||||
batch_op.alter_column('Quantity', new_column_name='quantity')
|
||||
batch_op.alter_column('Rate', new_column_name='rate')
|
||||
batch_op.alter_column('Tax', new_column_name='tax')
|
||||
batch_op.alter_column('VoucherID', new_column_name='voucher_id')
|
||||
|
||||
with op.batch_alter_table("journals") as batch_op:
|
||||
batch_op.alter_column('Amount', new_column_name='amount')
|
||||
batch_op.alter_column('CostCentreID', new_column_name='cost_centre_id')
|
||||
batch_op.alter_column('Debit', new_column_name='debit')
|
||||
batch_op.alter_column('JournalID', new_column_name='id')
|
||||
batch_op.alter_column('VoucherID', new_column_name='voucher_id')
|
||||
|
||||
with op.batch_alter_table("fingerprints") as batch_op:
|
||||
batch_op.alter_column('FingerprintID', new_column_name='id')
|
||||
batch_op.alter_column('Date', new_column_name='date')
|
||||
batch_op.alter_column('EmployeeID', new_column_name='employee_id')
|
||||
|
||||
with op.batch_alter_table("products") as batch_op:
|
||||
batch_op.alter_column('ProductID', new_column_name='id')
|
||||
batch_op.alter_column('Code', new_column_name='code')
|
||||
batch_op.alter_column('Fraction', new_column_name='fraction')
|
||||
batch_op.alter_column('FractionUnits', new_column_name='fraction_units')
|
||||
batch_op.alter_column('IsActive', new_column_name='is_active')
|
||||
batch_op.alter_column('IsFixture', new_column_name='is_fixture')
|
||||
batch_op.alter_column('Name', new_column_name='name')
|
||||
batch_op.alter_column('ProductGroupID', new_column_name='product_group_id')
|
||||
batch_op.alter_column('ProductYield', new_column_name='product_yield')
|
||||
batch_op.alter_column('Units', new_column_name='units')
|
||||
|
||||
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:
|
||||
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')
|
||||
batch_op.alter_column('EsiEmployer', new_column_name='esi_employer')
|
||||
batch_op.alter_column('GrossSalary', new_column_name='gross_salary')
|
||||
batch_op.alter_column('JournalID', new_column_name='journal_id')
|
||||
batch_op.alter_column('PfEmployee', new_column_name='pf_employee')
|
||||
batch_op.alter_column('PfEmployer', new_column_name='pf_employer')
|
||||
batch_op.alter_column('VoucherID', new_column_name='voucher_id')
|
||||
|
||||
with op.batch_alter_table("vouchers") as batch_op:
|
||||
batch_op.alter_column('VoucherID', new_column_name='id')
|
||||
|
||||
op.create_unique_constraint(op.f('uq_accounts_name'), 'accounts', ['name'])
|
||||
op.drop_constraint('accounts_name_key', 'accounts', type_='unique')
|
||||
op.create_unique_constraint(op.f('uq_auth_clients_code'), 'auth_clients', ['code'])
|
||||
op.create_unique_constraint(op.f('uq_auth_clients_name'), 'auth_clients', ['name'])
|
||||
op.drop_constraint('auth_clients_Code_key', 'auth_clients', type_='unique')
|
||||
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'])
|
||||
op.drop_constraint('entities_costcenters_Name_key', 'cost_centres', type_='unique')
|
||||
op.drop_constraint('uq_employee_id_date', 'fingerprints', type_='unique')
|
||||
op.create_index(op.f('ix_inventories_voucher_id'), 'inventories', ['voucher_id'], unique=False)
|
||||
op.create_unique_constraint(op.f('uq_inventories_voucher_id'), 'inventories', ['voucher_id', 'batch_id'])
|
||||
op.drop_index('ix_inventories_VoucherID', table_name='inventories')
|
||||
op.create_index(op.f('ix_journals_voucher_id'), 'journals', ['voucher_id'], unique=False)
|
||||
op.drop_index('ix_journals_VoucherID', table_name='journals')
|
||||
op.create_unique_constraint(op.f('uq_product_groups_name'), 'product_groups', ['name'])
|
||||
op.drop_constraint('entities_productgroups_Name_key', 'product_groups', type_='unique')
|
||||
op.create_unique_constraint(op.f('uq_products_code'), 'products', ['code'])
|
||||
op.create_unique_constraint(op.f('uq_products_name'), 'products', ['name', 'units'])
|
||||
op.drop_constraint('products_Code_key', 'products', type_='unique')
|
||||
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.drop_constraint('settings_Name_key', 'settings', type_='unique')
|
||||
op.create_index(op.f('ix_vouchers_date'), 'vouchers', ['date'], unique=False)
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
raise Exception("Irreversible migration")
|
@ -1,538 +0,0 @@
|
||||
"""my test
|
||||
|
||||
Revision ID: eed0b382c287
|
||||
Revises: 0bf3d70ee7de
|
||||
Create Date: 2020-05-10 19:52:58.163810
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'eed0b382c287'
|
||||
down_revision = '0bf3d70ee7de'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('auth_permissions',
|
||||
sa.Column('id', brewman.models.guidtype.GUID(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_auth_permissions')),
|
||||
sa.UniqueConstraint('name', name=op.f('uq_auth_permissions_name'))
|
||||
)
|
||||
op.create_table('role_permissions',
|
||||
sa.Column('id', brewman.models.guidtype.GUID(), nullable=False),
|
||||
sa.Column('permission_id', brewman.models.guidtype.GUID(), nullable=True),
|
||||
sa.Column('role_id', brewman.models.guidtype.GUID(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['permission_id'], ['auth_permissions.id'], name=op.f('fk_role_permissions_permission_id_auth_permissions')),
|
||||
sa.ForeignKeyConstraint(['role_id'], ['auth_roles.id'], name=op.f('fk_role_permissions_role_id_auth_roles')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_role_permissions'))
|
||||
)
|
||||
op.create_table('user_roles',
|
||||
sa.Column('id', brewman.models.guidtype.GUID(), nullable=False),
|
||||
sa.Column('user_id', brewman.models.guidtype.GUID(), nullable=True),
|
||||
sa.Column('role_id', brewman.models.guidtype.GUID(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['role_id'], ['auth_roles.id'], name=op.f('fk_user_roles_role_id_auth_roles')),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['auth_users.id'], name=op.f('fk_user_roles_user_id_auth_users')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_user_roles'))
|
||||
)
|
||||
op.drop_table('msg_subscribers')
|
||||
op.drop_table('auth_rolegroups')
|
||||
op.drop_table('auth_groups')
|
||||
op.drop_table('msg_posts')
|
||||
op.drop_table('msg_threadtags')
|
||||
op.drop_table('msg_threads')
|
||||
op.drop_table('msg_tags')
|
||||
op.drop_table('auth_usergroups')
|
||||
op.create_unique_constraint(op.f('uq_accounts_name'), 'accounts', ['name'])
|
||||
op.drop_constraint('accounts_name_key', 'accounts', type_='unique')
|
||||
op.drop_constraint('accounts_cost_centre_id_fkey', 'accounts', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_accounts_cost_centre_id_cost_centres'), 'accounts', 'cost_centres', ['cost_centre_id'], ['id'])
|
||||
op.add_column('attendances', sa.Column('amount', sa.Numeric(), nullable=True))
|
||||
op.add_column('attendances', sa.Column('attendance_type', sa.Integer(), nullable=True))
|
||||
op.add_column('attendances', sa.Column('creation_date', sa.DateTime(timezone=True), nullable=True))
|
||||
op.add_column('attendances', sa.Column('date', sa.DateTime(), nullable=True))
|
||||
op.add_column('attendances', sa.Column('employee_id', brewman.models.guidtype.GUID(), nullable=True))
|
||||
op.add_column('attendances', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('attendances', sa.Column('is_valid', sa.Boolean(), nullable=True))
|
||||
op.add_column('attendances', sa.Column('user_id', brewman.models.guidtype.GUID(), nullable=True))
|
||||
op.drop_constraint('entities_attendances_UserID_fkey', 'attendances', type_='foreignkey')
|
||||
op.drop_constraint('entities_attendances_EmployeeID_fkey', 'attendances', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_attendances_employee_id_employees'), 'attendances', 'employees', ['employee_id'], ['id'])
|
||||
op.create_foreign_key(op.f('fk_attendances_user_id_auth_users'), 'attendances', 'auth_users', ['user_id'], ['id'])
|
||||
op.drop_column('attendances', 'CreationDate')
|
||||
op.drop_column('attendances', 'EmployeeID')
|
||||
op.drop_column('attendances', 'Date')
|
||||
op.drop_column('attendances', 'AttendanceID')
|
||||
op.drop_column('attendances', 'Amount')
|
||||
op.drop_column('attendances', 'AttendanceType')
|
||||
op.drop_column('attendances', 'IsValid')
|
||||
op.drop_column('attendances', 'UserID')
|
||||
op.create_unique_constraint(op.f('uq_auth_clients_code'), 'auth_clients', ['code'])
|
||||
op.create_unique_constraint(op.f('uq_auth_clients_name'), 'auth_clients', ['name'])
|
||||
op.drop_constraint('auth_clients_Code_key', 'auth_clients', type_='unique')
|
||||
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.drop_constraint('auth_login_history_user_id_fkey', 'auth_login_history', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_auth_login_history_user_id_auth_users'), 'auth_login_history', 'auth_users', ['user_id'], ['id'])
|
||||
op.add_column('auth_roles', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
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_roles_Name_key', 'auth_roles', type_='unique')
|
||||
op.drop_column('auth_roles', 'RoleID')
|
||||
op.drop_column('auth_roles', 'Name')
|
||||
op.add_column('auth_users', sa.Column('disabled', sa.Boolean(), nullable=True))
|
||||
op.add_column('auth_users', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('auth_users', sa.Column('password', sa.Unicode(length=60), nullable=True))
|
||||
op.add_column('auth_users', sa.Column('username', sa.Unicode(length=255), nullable=True))
|
||||
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.drop_column('auth_users', 'UserID')
|
||||
op.drop_column('auth_users', 'Name')
|
||||
op.drop_column('auth_users', 'Password')
|
||||
op.drop_column('auth_users', 'LockedOut')
|
||||
op.add_column('batches', sa.Column('discount', sa.Numeric(), nullable=True))
|
||||
op.add_column('batches', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('batches', sa.Column('name', sa.DateTime(), nullable=True))
|
||||
op.add_column('batches', sa.Column('product_id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('batches', sa.Column('quantity_remaining', sa.Numeric(), nullable=True))
|
||||
op.add_column('batches', sa.Column('rate', sa.Numeric(), nullable=True))
|
||||
op.add_column('batches', sa.Column('tax', sa.Numeric(), nullable=True))
|
||||
op.drop_constraint('batches_ProductID_fkey', 'batches', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_batches_product_id_products'), 'batches', 'products', ['product_id'], ['id'])
|
||||
op.drop_column('batches', 'QuantityRemaining')
|
||||
op.drop_column('batches', 'Rate')
|
||||
op.drop_column('batches', 'Tax')
|
||||
op.drop_column('batches', 'BatchID')
|
||||
op.drop_column('batches', 'ProductID')
|
||||
op.drop_column('batches', 'Name')
|
||||
op.drop_column('batches', 'Discount')
|
||||
op.add_column('cost_centres', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('cost_centres', sa.Column('is_fixture', sa.Boolean(), nullable=False))
|
||||
op.add_column('cost_centres', sa.Column('name', sa.Unicode(length=255), nullable=True))
|
||||
op.create_unique_constraint(op.f('uq_cost_centres_name'), 'cost_centres', ['name'])
|
||||
op.drop_constraint('entities_costcenters_Name_key', 'cost_centres', type_='unique')
|
||||
op.drop_column('cost_centres', 'Name')
|
||||
op.drop_column('cost_centres', 'IsFixture')
|
||||
op.drop_column('cost_centres', 'CostCentreID')
|
||||
op.add_column('fingerprints', sa.Column('date', sa.DateTime(), nullable=True))
|
||||
op.add_column('fingerprints', sa.Column('employee_id', brewman.models.guidtype.GUID(), nullable=True))
|
||||
op.add_column('fingerprints', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.drop_constraint('uq_employee_id_date', 'fingerprints', type_='unique')
|
||||
op.drop_constraint('entities_fingerprints_EmployeeID_fkey', 'fingerprints', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_fingerprints_employee_id_employees'), 'fingerprints', 'employees', ['employee_id'], ['id'])
|
||||
op.drop_column('fingerprints', 'FingerprintID')
|
||||
op.drop_column('fingerprints', 'EmployeeID')
|
||||
op.drop_column('fingerprints', 'Date')
|
||||
op.add_column('inventories', sa.Column('batch_id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('inventories', sa.Column('discount', sa.Numeric(), nullable=True))
|
||||
op.add_column('inventories', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('inventories', sa.Column('product_id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('inventories', sa.Column('quantity', sa.Numeric(), nullable=True))
|
||||
op.add_column('inventories', sa.Column('rate', sa.Numeric(), nullable=True))
|
||||
op.add_column('inventories', sa.Column('tax', sa.Numeric(), nullable=True))
|
||||
op.add_column('inventories', sa.Column('voucher_id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.create_index(op.f('ix_inventories_voucher_id'), 'inventories', ['voucher_id'], unique=False)
|
||||
op.create_unique_constraint(op.f('uq_inventories_voucher_id'), 'inventories', ['voucher_id', 'batch_id'])
|
||||
op.drop_index('ix_inventories_VoucherID', table_name='inventories')
|
||||
op.drop_constraint('entities_inventories_BatchID_fkey', 'inventories', type_='foreignkey')
|
||||
op.drop_constraint('inventories_VoucherID_fkey', 'inventories', type_='foreignkey')
|
||||
op.drop_constraint('inventories_ProductID_fkey', 'inventories', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_inventories_voucher_id_vouchers'), 'inventories', 'vouchers', ['voucher_id'], ['id'])
|
||||
op.create_foreign_key(op.f('fk_inventories_batch_id_batches'), 'inventories', 'batches', ['batch_id'], ['id'])
|
||||
op.create_foreign_key(op.f('fk_inventories_product_id_products'), 'inventories', 'products', ['product_id'], ['id'])
|
||||
op.drop_column('inventories', 'InventoryID')
|
||||
op.drop_column('inventories', 'VoucherID')
|
||||
op.drop_column('inventories', 'Rate')
|
||||
op.drop_column('inventories', 'Tax')
|
||||
op.drop_column('inventories', 'BatchID')
|
||||
op.drop_column('inventories', 'ProductID')
|
||||
op.drop_column('inventories', 'Quantity')
|
||||
op.drop_column('inventories', 'Discount')
|
||||
op.add_column('journals', sa.Column('amount', sa.Numeric(), nullable=True))
|
||||
op.add_column('journals', sa.Column('cost_centre_id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('journals', sa.Column('debit', sa.Integer(), nullable=True))
|
||||
op.add_column('journals', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('journals', sa.Column('voucher_id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.create_index(op.f('ix_journals_voucher_id'), 'journals', ['voucher_id'], unique=False)
|
||||
op.drop_index('ix_journals_VoucherID', table_name='journals')
|
||||
op.drop_constraint('journals_VoucherID_fkey', 'journals', type_='foreignkey')
|
||||
op.drop_constraint('entities_journals_CostCenterID_fkey', 'journals', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_journals_cost_centre_id_cost_centres'), 'journals', 'cost_centres', ['cost_centre_id'], ['id'])
|
||||
op.create_foreign_key(op.f('fk_journals_voucher_id_vouchers'), 'journals', 'vouchers', ['voucher_id'], ['id'])
|
||||
op.drop_column('journals', 'Debit')
|
||||
op.drop_column('journals', 'JournalID')
|
||||
op.drop_column('journals', 'VoucherID')
|
||||
op.drop_column('journals', 'Amount')
|
||||
op.drop_column('journals', 'CostCentreID')
|
||||
op.add_column('product_groups', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('product_groups', sa.Column('is_fixture', sa.Boolean(), nullable=False))
|
||||
op.add_column('product_groups', sa.Column('name', sa.Unicode(length=255), nullable=True))
|
||||
op.create_unique_constraint(op.f('uq_product_groups_name'), 'product_groups', ['name'])
|
||||
op.drop_constraint('entities_productgroups_Name_key', 'product_groups', type_='unique')
|
||||
op.drop_column('product_groups', 'Name')
|
||||
op.drop_column('product_groups', 'ProductGroupID')
|
||||
op.drop_column('product_groups', 'IsFixture')
|
||||
op.add_column('products', sa.Column('code', sa.Integer(), nullable=True))
|
||||
op.add_column('products', sa.Column('fraction', sa.Numeric(), nullable=False))
|
||||
op.add_column('products', sa.Column('fraction_units', sa.Unicode(length=255), nullable=False))
|
||||
op.add_column('products', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('products', sa.Column('is_active', sa.Boolean(), nullable=False))
|
||||
op.add_column('products', sa.Column('is_fixture', sa.Boolean(), nullable=False))
|
||||
op.add_column('products', sa.Column('name', sa.Unicode(length=255), nullable=False))
|
||||
op.add_column('products', sa.Column('product_group_id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('products', sa.Column('product_yield', sa.Numeric(), nullable=False))
|
||||
op.add_column('products', sa.Column('units', sa.Unicode(length=255), nullable=False))
|
||||
op.create_unique_constraint(op.f('uq_products_code'), 'products', ['code'])
|
||||
op.create_unique_constraint(op.f('uq_products_name'), 'products', ['name', 'units'])
|
||||
op.drop_constraint('products_Code_key', 'products', type_='unique')
|
||||
op.drop_constraint('products_Name_Units_key', 'products', type_='unique')
|
||||
op.drop_constraint('products_ProductGroupID_fkey', 'products', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_products_product_group_id_product_groups'), 'products', 'product_groups', ['product_group_id'], ['id'])
|
||||
op.drop_column('products', 'Fraction')
|
||||
op.drop_column('products', 'Units')
|
||||
op.drop_column('products', 'ProductGroupID')
|
||||
op.drop_column('products', 'IsFixture')
|
||||
op.drop_column('products', 'FractionUnits')
|
||||
op.drop_column('products', 'Code')
|
||||
op.drop_column('products', 'ProductID')
|
||||
op.drop_column('products', 'IsActive')
|
||||
op.drop_column('products', 'Name')
|
||||
op.drop_column('products', 'ProductYield')
|
||||
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.drop_constraint('recipe_items_recipe_id_fkey', 'recipe_items', type_='foreignkey')
|
||||
op.drop_constraint('recipe_items_product_id_fkey', 'recipe_items', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_recipe_items_product_id_products'), 'recipe_items', 'products', ['product_id'], ['id'])
|
||||
op.create_foreign_key(op.f('fk_recipe_items_recipe_id_recipes'), 'recipe_items', 'recipes', ['recipe_id'], ['id'])
|
||||
op.add_column('recipes', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.drop_constraint('recipes_product_id_fkey', 'recipes', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_recipes_product_id_products'), 'recipes', 'products', ['product_id'], ['id'])
|
||||
op.drop_column('recipes', 'recipe_id')
|
||||
op.add_column('salary_deductions', sa.Column('days_worked', sa.Integer(), nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('esi_employee', sa.Integer(), nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('esi_employer', sa.Integer(), nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('gross_salary', sa.Integer(), nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('salary_deductions', sa.Column('journal_id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.add_column('salary_deductions', sa.Column('pf_employee', sa.Integer(), nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('pf_employer', sa.Integer(), nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('voucher_id', brewman.models.guidtype.GUID(), nullable=False))
|
||||
op.drop_constraint('entities_salarydeductions_JournalID_fkey', 'salary_deductions', type_='foreignkey')
|
||||
op.drop_constraint('salary_deductions_VoucherID_fkey', 'salary_deductions', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_salary_deductions_voucher_id_vouchers'), 'salary_deductions', 'vouchers', ['voucher_id'], ['id'])
|
||||
op.create_foreign_key(op.f('fk_salary_deductions_journal_id_journals'), 'salary_deductions', 'journals', ['journal_id'], ['id'])
|
||||
op.drop_column('salary_deductions', 'JournalID')
|
||||
op.drop_column('salary_deductions', 'VoucherID')
|
||||
op.drop_column('salary_deductions', 'EsiEmployee')
|
||||
op.drop_column('salary_deductions', 'PfEmployer')
|
||||
op.drop_column('salary_deductions', 'DaysWorked')
|
||||
op.drop_column('salary_deductions', 'GrossSalary')
|
||||
op.drop_column('salary_deductions', 'PfEmployee')
|
||||
op.drop_column('salary_deductions', 'SalaryDeductionID')
|
||||
op.drop_column('salary_deductions', 'EsiEmployer')
|
||||
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.create_foreign_key(op.f('fk_service_charges_journal_id_journals'), 'service_charges', 'journals', ['journal_id'], ['id'])
|
||||
op.create_foreign_key(op.f('fk_service_charges_voucher_id_vouchers'), 'service_charges', 'vouchers', ['voucher_id'], ['id'])
|
||||
op.create_unique_constraint(op.f('uq_settings_Name'), 'settings', ['Name'])
|
||||
op.drop_constraint('settings_Name_key', 'settings', type_='unique')
|
||||
# op.add_column('vouchers', sa.Column('id', postgresql.UUID(), nullable=False))
|
||||
op.create_index(op.f('ix_vouchers_date'), 'vouchers', ['date'], unique=False)
|
||||
|
||||
op.drop_constraint('vouchers_poster_id_fkey', 'vouchers', type_='foreignkey')
|
||||
op.drop_constraint('vouchers_user_id_fkey', 'vouchers', type_='foreignkey')
|
||||
op.create_foreign_key(op.f('fk_vouchers_user_id_auth_users'), 'vouchers', 'auth_users', ['user_id'], ['id'])
|
||||
op.create_foreign_key(op.f('fk_vouchers_poster_id_auth_users'), 'vouchers', 'auth_users', ['poster_id'], ['id'])
|
||||
with op.batch_alter_table("vouchers") as batch_op:
|
||||
batch_op.alter_column('vouchers', 'VoucherID', new_column_name='id')
|
||||
# op.drop_column('vouchers', 'VoucherID')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('vouchers', sa.Column('VoucherID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.drop_constraint(op.f('fk_vouchers_poster_id_auth_users'), 'vouchers', type_='foreignkey')
|
||||
op.drop_constraint(op.f('fk_vouchers_user_id_auth_users'), 'vouchers', type_='foreignkey')
|
||||
op.create_foreign_key('vouchers_user_id_fkey', 'vouchers', 'auth_users', ['user_id'], ['UserID'])
|
||||
op.create_foreign_key('vouchers_poster_id_fkey', 'vouchers', 'auth_users', ['poster_id'], ['UserID'])
|
||||
op.drop_index(op.f('ix_vouchers_date'), table_name='vouchers')
|
||||
op.drop_column('vouchers', 'id')
|
||||
op.create_unique_constraint('settings_Name_key', 'settings', ['Name'])
|
||||
op.drop_constraint(op.f('uq_settings_Name'), 'settings', type_='unique')
|
||||
op.drop_constraint(op.f('fk_service_charges_voucher_id_vouchers'), 'service_charges', type_='foreignkey')
|
||||
op.drop_constraint(op.f('fk_service_charges_journal_id_journals'), 'service_charges', type_='foreignkey')
|
||||
op.create_foreign_key('service_charges_voucher_id_fkey', 'service_charges', 'vouchers', ['voucher_id'], ['VoucherID'])
|
||||
op.create_foreign_key('service_charges_journal_id_fkey', 'service_charges', 'journals', ['journal_id'], ['JournalID'])
|
||||
op.add_column('salary_deductions', sa.Column('EsiEmployer', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('SalaryDeductionID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('salary_deductions', sa.Column('PfEmployee', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('GrossSalary', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('DaysWorked', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('PfEmployer', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('EsiEmployee', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('salary_deductions', sa.Column('VoucherID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('salary_deductions', sa.Column('JournalID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.drop_constraint(op.f('fk_salary_deductions_journal_id_journals'), 'salary_deductions', type_='foreignkey')
|
||||
op.drop_constraint(op.f('fk_salary_deductions_voucher_id_vouchers'), 'salary_deductions', type_='foreignkey')
|
||||
op.create_foreign_key('salary_deductions_VoucherID_fkey', 'salary_deductions', 'vouchers', ['VoucherID'], ['VoucherID'])
|
||||
op.create_foreign_key('entities_salarydeductions_JournalID_fkey', 'salary_deductions', 'journals', ['JournalID'], ['JournalID'])
|
||||
op.drop_column('salary_deductions', 'voucher_id')
|
||||
op.drop_column('salary_deductions', 'pf_employer')
|
||||
op.drop_column('salary_deductions', 'pf_employee')
|
||||
op.drop_column('salary_deductions', 'journal_id')
|
||||
op.drop_column('salary_deductions', 'id')
|
||||
op.drop_column('salary_deductions', 'gross_salary')
|
||||
op.drop_column('salary_deductions', 'esi_employer')
|
||||
op.drop_column('salary_deductions', 'esi_employee')
|
||||
op.drop_column('salary_deductions', 'days_worked')
|
||||
op.add_column('recipes', sa.Column('recipe_id', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.drop_constraint(op.f('fk_recipes_product_id_products'), 'recipes', type_='foreignkey')
|
||||
op.create_foreign_key('recipes_product_id_fkey', 'recipes', 'products', ['product_id'], ['ProductID'])
|
||||
op.drop_column('recipes', 'id')
|
||||
op.drop_constraint(op.f('fk_recipe_items_recipe_id_recipes'), 'recipe_items', type_='foreignkey')
|
||||
op.drop_constraint(op.f('fk_recipe_items_product_id_products'), 'recipe_items', type_='foreignkey')
|
||||
op.create_foreign_key('recipe_items_product_id_fkey', 'recipe_items', 'products', ['product_id'], ['ProductID'])
|
||||
op.create_foreign_key('recipe_items_recipe_id_fkey', 'recipe_items', 'recipes', ['recipe_id'], ['recipe_id'])
|
||||
op.create_unique_constraint('recipe_items_recipe_id_product_id_key', 'recipe_items', ['recipe_id', 'product_id'])
|
||||
op.drop_constraint(op.f('uq_recipe_items_recipe_id'), 'recipe_items', type_='unique')
|
||||
op.add_column('products', sa.Column('ProductYield', sa.NUMERIC(), autoincrement=False, nullable=False))
|
||||
op.add_column('products', sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=False))
|
||||
op.add_column('products', sa.Column('IsActive', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.add_column('products', sa.Column('ProductID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('products', sa.Column('Code', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('products', sa.Column('FractionUnits', sa.VARCHAR(length=255), autoincrement=False, nullable=False))
|
||||
op.add_column('products', sa.Column('IsFixture', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.add_column('products', sa.Column('ProductGroupID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('products', sa.Column('Units', sa.VARCHAR(length=255), autoincrement=False, nullable=False))
|
||||
op.add_column('products', sa.Column('Fraction', sa.NUMERIC(), autoincrement=False, nullable=False))
|
||||
op.drop_constraint(op.f('fk_products_product_group_id_product_groups'), 'products', type_='foreignkey')
|
||||
op.create_foreign_key('products_ProductGroupID_fkey', 'products', 'product_groups', ['ProductGroupID'], ['ProductGroupID'])
|
||||
op.create_unique_constraint('products_Name_Units_key', 'products', ['Name', 'Units'])
|
||||
op.create_unique_constraint('products_Code_key', 'products', ['Code'])
|
||||
op.drop_constraint(op.f('uq_products_name'), 'products', type_='unique')
|
||||
op.drop_constraint(op.f('uq_products_code'), 'products', type_='unique')
|
||||
op.drop_column('products', 'units')
|
||||
op.drop_column('products', 'product_yield')
|
||||
op.drop_column('products', 'product_group_id')
|
||||
op.drop_column('products', 'name')
|
||||
op.drop_column('products', 'is_fixture')
|
||||
op.drop_column('products', 'is_active')
|
||||
op.drop_column('products', 'id')
|
||||
op.drop_column('products', 'fraction_units')
|
||||
op.drop_column('products', 'fraction')
|
||||
op.drop_column('products', 'code')
|
||||
op.add_column('product_groups', sa.Column('IsFixture', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.add_column('product_groups', sa.Column('ProductGroupID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('product_groups', sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
|
||||
op.create_unique_constraint('entities_productgroups_Name_key', 'product_groups', ['Name'])
|
||||
op.drop_constraint(op.f('uq_product_groups_name'), 'product_groups', type_='unique')
|
||||
op.drop_column('product_groups', 'name')
|
||||
op.drop_column('product_groups', 'is_fixture')
|
||||
op.drop_column('product_groups', 'id')
|
||||
op.add_column('journals', sa.Column('CostCentreID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('journals', sa.Column('Amount', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('journals', sa.Column('VoucherID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('journals', sa.Column('JournalID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('journals', sa.Column('Debit', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.drop_constraint(op.f('fk_journals_voucher_id_vouchers'), 'journals', type_='foreignkey')
|
||||
op.drop_constraint(op.f('fk_journals_cost_centre_id_cost_centres'), 'journals', type_='foreignkey')
|
||||
op.create_foreign_key('entities_journals_CostCenterID_fkey', 'journals', 'cost_centres', ['CostCentreID'], ['CostCentreID'])
|
||||
op.create_foreign_key('journals_VoucherID_fkey', 'journals', 'vouchers', ['VoucherID'], ['VoucherID'])
|
||||
op.create_index('ix_journals_VoucherID', 'journals', ['VoucherID'], unique=False)
|
||||
op.drop_index(op.f('ix_journals_voucher_id'), table_name='journals')
|
||||
op.drop_column('journals', 'voucher_id')
|
||||
op.drop_column('journals', 'id')
|
||||
op.drop_column('journals', 'debit')
|
||||
op.drop_column('journals', 'cost_centre_id')
|
||||
op.drop_column('journals', 'amount')
|
||||
op.add_column('inventories', sa.Column('Discount', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('inventories', sa.Column('Quantity', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('inventories', sa.Column('ProductID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('inventories', sa.Column('BatchID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('inventories', sa.Column('Tax', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('inventories', sa.Column('Rate', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('inventories', sa.Column('VoucherID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('inventories', sa.Column('InventoryID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.drop_constraint(op.f('fk_inventories_product_id_products'), 'inventories', type_='foreignkey')
|
||||
op.drop_constraint(op.f('fk_inventories_batch_id_batches'), 'inventories', type_='foreignkey')
|
||||
op.drop_constraint(op.f('fk_inventories_voucher_id_vouchers'), 'inventories', type_='foreignkey')
|
||||
op.create_foreign_key('inventories_ProductID_fkey', 'inventories', 'products', ['ProductID'], ['ProductID'])
|
||||
op.create_foreign_key('inventories_VoucherID_fkey', 'inventories', 'vouchers', ['VoucherID'], ['VoucherID'])
|
||||
op.create_foreign_key('entities_inventories_BatchID_fkey', 'inventories', 'batches', ['BatchID'], ['BatchID'])
|
||||
op.create_index('ix_inventories_VoucherID', 'inventories', ['VoucherID'], unique=False)
|
||||
op.drop_constraint(op.f('uq_inventories_voucher_id'), 'inventories', type_='unique')
|
||||
op.drop_index(op.f('ix_inventories_voucher_id'), table_name='inventories')
|
||||
op.drop_column('inventories', 'voucher_id')
|
||||
op.drop_column('inventories', 'tax')
|
||||
op.drop_column('inventories', 'rate')
|
||||
op.drop_column('inventories', 'quantity')
|
||||
op.drop_column('inventories', 'product_id')
|
||||
op.drop_column('inventories', 'id')
|
||||
op.drop_column('inventories', 'discount')
|
||||
op.drop_column('inventories', 'batch_id')
|
||||
op.add_column('fingerprints', sa.Column('Date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
|
||||
op.add_column('fingerprints', sa.Column('EmployeeID', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.add_column('fingerprints', sa.Column('FingerprintID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.drop_constraint(op.f('fk_fingerprints_employee_id_employees'), 'fingerprints', type_='foreignkey')
|
||||
op.create_foreign_key('entities_fingerprints_EmployeeID_fkey', 'fingerprints', 'employees', ['EmployeeID'], ['id'])
|
||||
op.create_unique_constraint('uq_employee_id_date', 'fingerprints', ['EmployeeID', 'Date'])
|
||||
op.drop_column('fingerprints', 'id')
|
||||
op.drop_column('fingerprints', 'employee_id')
|
||||
op.drop_column('fingerprints', 'date')
|
||||
op.add_column('cost_centres', sa.Column('CostCentreID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('cost_centres', sa.Column('IsFixture', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.add_column('cost_centres', sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
|
||||
op.create_unique_constraint('entities_costcenters_Name_key', 'cost_centres', ['Name'])
|
||||
op.drop_constraint(op.f('uq_cost_centres_name'), 'cost_centres', type_='unique')
|
||||
op.drop_column('cost_centres', 'name')
|
||||
op.drop_column('cost_centres', 'is_fixture')
|
||||
op.drop_column('cost_centres', 'id')
|
||||
op.add_column('batches', sa.Column('Discount', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('batches', sa.Column('Name', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
|
||||
op.add_column('batches', sa.Column('ProductID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('batches', sa.Column('BatchID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('batches', sa.Column('Tax', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('batches', sa.Column('Rate', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('batches', sa.Column('QuantityRemaining', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.drop_constraint(op.f('fk_batches_product_id_products'), 'batches', type_='foreignkey')
|
||||
op.create_foreign_key('batches_ProductID_fkey', 'batches', 'products', ['ProductID'], ['ProductID'])
|
||||
op.drop_column('batches', 'tax')
|
||||
op.drop_column('batches', 'rate')
|
||||
op.drop_column('batches', 'quantity_remaining')
|
||||
op.drop_column('batches', 'product_id')
|
||||
op.drop_column('batches', 'name')
|
||||
op.drop_column('batches', 'id')
|
||||
op.drop_column('batches', 'discount')
|
||||
op.add_column('auth_users', sa.Column('LockedOut', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
op.add_column('auth_users', sa.Column('Password', sa.VARCHAR(length=60), autoincrement=False, nullable=True))
|
||||
op.add_column('auth_users', sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
|
||||
op.add_column('auth_users', sa.Column('UserID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.create_unique_constraint('auth_users_Name_key', 'auth_users', ['Name'])
|
||||
op.drop_constraint(op.f('uq_auth_users_username'), 'auth_users', type_='unique')
|
||||
op.drop_column('auth_users', 'username')
|
||||
op.drop_column('auth_users', 'password')
|
||||
op.drop_column('auth_users', 'id')
|
||||
op.drop_column('auth_users', 'disabled')
|
||||
op.add_column('auth_roles', sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
|
||||
op.add_column('auth_roles', sa.Column('RoleID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.create_unique_constraint('auth_roles_Name_key', 'auth_roles', ['Name'])
|
||||
op.drop_constraint(op.f('uq_auth_roles_name'), 'auth_roles', type_='unique')
|
||||
op.drop_column('auth_roles', 'name')
|
||||
op.drop_column('auth_roles', 'id')
|
||||
op.drop_constraint(op.f('fk_auth_login_history_user_id_auth_users'), 'auth_login_history', type_='foreignkey')
|
||||
op.create_foreign_key('auth_login_history_user_id_fkey', 'auth_login_history', 'auth_users', ['user_id'], ['UserID'])
|
||||
op.create_unique_constraint('auth_login_history_user_id_client_id_date_key', 'auth_login_history', ['user_id', 'client_id', 'date'])
|
||||
op.drop_constraint(op.f('uq_auth_login_history_user_id'), 'auth_login_history', type_='unique')
|
||||
op.create_unique_constraint('auth_clients_Name_key', 'auth_clients', ['name'])
|
||||
op.create_unique_constraint('auth_clients_Code_key', 'auth_clients', ['code'])
|
||||
op.drop_constraint(op.f('uq_auth_clients_name'), 'auth_clients', type_='unique')
|
||||
op.drop_constraint(op.f('uq_auth_clients_code'), 'auth_clients', type_='unique')
|
||||
op.add_column('attendances', sa.Column('UserID', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.add_column('attendances', sa.Column('IsValid', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
op.add_column('attendances', sa.Column('AttendanceType', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('attendances', sa.Column('Amount', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('attendances', sa.Column('AttendanceID', postgresql.UUID(), autoincrement=False, nullable=False))
|
||||
op.add_column('attendances', sa.Column('Date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
|
||||
op.add_column('attendances', sa.Column('EmployeeID', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.add_column('attendances', sa.Column('CreationDate', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True))
|
||||
op.drop_constraint(op.f('fk_attendances_user_id_auth_users'), 'attendances', type_='foreignkey')
|
||||
op.drop_constraint(op.f('fk_attendances_employee_id_employees'), 'attendances', type_='foreignkey')
|
||||
op.create_foreign_key('entities_attendances_EmployeeID_fkey', 'attendances', 'employees', ['EmployeeID'], ['id'])
|
||||
op.create_foreign_key('entities_attendances_UserID_fkey', 'attendances', 'auth_users', ['UserID'], ['UserID'])
|
||||
op.drop_column('attendances', 'user_id')
|
||||
op.drop_column('attendances', 'is_valid')
|
||||
op.drop_column('attendances', 'id')
|
||||
op.drop_column('attendances', 'employee_id')
|
||||
op.drop_column('attendances', 'date')
|
||||
op.drop_column('attendances', 'creation_date')
|
||||
op.drop_column('attendances', 'attendance_type')
|
||||
op.drop_column('attendances', 'amount')
|
||||
op.drop_constraint(op.f('fk_accounts_cost_centre_id_cost_centres'), 'accounts', type_='foreignkey')
|
||||
op.create_foreign_key('accounts_cost_centre_id_fkey', 'accounts', 'cost_centres', ['cost_centre_id'], ['CostCentreID'])
|
||||
op.create_unique_constraint('accounts_name_key', 'accounts', ['name'])
|
||||
op.drop_constraint(op.f('uq_accounts_name'), 'accounts', type_='unique')
|
||||
op.create_table('auth_usergroups',
|
||||
sa.Column('UserGroupID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('UserID', postgresql.UUID(), autoincrement=False, nullable=True),
|
||||
sa.Column('GroupID', postgresql.UUID(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['GroupID'], ['auth_groups.GroupID'], name='auth_usergroups_GroupID_fkey'),
|
||||
sa.ForeignKeyConstraint(['UserID'], ['auth_users.UserID'], name='auth_usergroups_UserID_fkey'),
|
||||
sa.PrimaryKeyConstraint('UserGroupID', name='auth_usergroups_pkey')
|
||||
)
|
||||
op.create_table('msg_tags',
|
||||
sa.Column('TagID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('Name', sa.VARCHAR(length=100), autoincrement=False, nullable=False),
|
||||
sa.Column('CssClass', sa.VARCHAR(length=100), autoincrement=False, nullable=True),
|
||||
sa.PrimaryKeyConstraint('TagID', name='msg_tags_pkey'),
|
||||
sa.UniqueConstraint('Name', name='msg_tags_Name_key'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_table('msg_threads',
|
||||
sa.Column('ThreadID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('Title', sa.VARCHAR(length=1000), autoincrement=False, nullable=False),
|
||||
sa.Column('CreationDate', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False),
|
||||
sa.Column('UserID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('Priority', sa.INTEGER(), autoincrement=False, nullable=False),
|
||||
sa.Column('Public', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('Closed', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.ForeignKeyConstraint(['UserID'], ['auth_users.UserID'], name='msg_threads_UserID_fkey'),
|
||||
sa.PrimaryKeyConstraint('ThreadID', name='msg_threads_pkey'),
|
||||
sa.UniqueConstraint('Title', name='msg_threads_Title_key'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_table('msg_threadtags',
|
||||
sa.Column('ThreadTagID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('ThreadID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('TagID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.ForeignKeyConstraint(['TagID'], ['msg_tags.TagID'], name='msg_threadtags_TagID_fkey'),
|
||||
sa.ForeignKeyConstraint(['ThreadID'], ['msg_threads.ThreadID'], name='msg_threadtags_ThreadID_fkey'),
|
||||
sa.PrimaryKeyConstraint('ThreadTagID', name='msg_threadtags_pkey'),
|
||||
sa.UniqueConstraint('ThreadID', 'TagID', name='msg_threadtags_ThreadID_TagID_key')
|
||||
)
|
||||
op.create_table('msg_posts',
|
||||
sa.Column('PostID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('Content', sa.VARCHAR(length=1000), autoincrement=False, nullable=False),
|
||||
sa.Column('CreationDate', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False),
|
||||
sa.Column('UserID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('Date', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.Column('ThreadID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.ForeignKeyConstraint(['ThreadID'], ['msg_threads.ThreadID'], name='msg_posts_ThreadID_fkey'),
|
||||
sa.ForeignKeyConstraint(['UserID'], ['auth_users.UserID'], name='msg_posts_UserID_fkey'),
|
||||
sa.PrimaryKeyConstraint('PostID', name='msg_posts_pkey')
|
||||
)
|
||||
op.create_table('auth_groups',
|
||||
sa.Column('GroupID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
|
||||
sa.PrimaryKeyConstraint('GroupID', name='auth_groups_pkey'),
|
||||
sa.UniqueConstraint('Name', name='auth_groups_Name_key'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_table('auth_rolegroups',
|
||||
sa.Column('RoleGroupID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('RoleID', postgresql.UUID(), autoincrement=False, nullable=True),
|
||||
sa.Column('GroupID', postgresql.UUID(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['GroupID'], ['auth_groups.GroupID'], name='auth_rolegroups_GroupID_fkey'),
|
||||
sa.ForeignKeyConstraint(['RoleID'], ['auth_roles.RoleID'], name='auth_rolegroups_RoleID_fkey'),
|
||||
sa.PrimaryKeyConstraint('RoleGroupID', name='auth_rolegroups_pkey')
|
||||
)
|
||||
op.create_table('msg_subscribers',
|
||||
sa.Column('SubscriberID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('ThreadID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('UserID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('Read', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.ForeignKeyConstraint(['ThreadID'], ['msg_threads.ThreadID'], name='msg_subscribers_ThreadID_fkey'),
|
||||
sa.ForeignKeyConstraint(['UserID'], ['auth_users.UserID'], name='msg_subscribers_UserID_fkey'),
|
||||
sa.PrimaryKeyConstraint('SubscriberID', name='msg_subscribers_pkey'),
|
||||
sa.UniqueConstraint('ThreadID', 'UserID', name='msg_subscribers_ThreadID_UserID_key')
|
||||
)
|
||||
op.drop_table('user_roles')
|
||||
op.drop_table('role_permissions')
|
||||
op.drop_table('auth_permissions')
|
||||
# ### end Alembic commands ###
|
Loading…
x
Reference in New Issue
Block a user