379 lines
24 KiB
Python
379 lines
24 KiB
Python
|
"""my test
|
||
|
|
||
|
Revision ID: bc2f5ea0c0d7
|
||
|
Revises:
|
||
|
Create Date: 2020-05-10 18:18:15.377295
|
||
|
|
||
|
"""
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
from sqlalchemy.dialects import postgresql
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = 'bc2f5ea0c0d7'
|
||
|
down_revision = None
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.drop_table('salary_deductions')
|
||
|
op.drop_table('auth_clients')
|
||
|
op.drop_table('auth_usergroups')
|
||
|
op.drop_index('ix_inventories_VoucherID', table_name='inventories')
|
||
|
op.drop_table('inventories')
|
||
|
op.drop_table('employees')
|
||
|
op.drop_table('msg_threadtags')
|
||
|
op.drop_table('fingerprints')
|
||
|
op.drop_table('products')
|
||
|
op.drop_table('cost_centres')
|
||
|
op.drop_table('attendances')
|
||
|
op.drop_table('product_groups')
|
||
|
op.drop_table('accounts')
|
||
|
op.drop_table('recipe_items')
|
||
|
op.drop_table('auth_users')
|
||
|
op.drop_table('msg_subscribers')
|
||
|
op.drop_table('auth_roles')
|
||
|
op.drop_table('msg_tags')
|
||
|
op.drop_table('images')
|
||
|
op.drop_table('vouchers')
|
||
|
op.drop_table('msg_threads')
|
||
|
op.drop_table('auth_rolegroups')
|
||
|
op.drop_table('batches')
|
||
|
op.drop_index('ix_journals_VoucherID', table_name='journals')
|
||
|
op.drop_table('journals')
|
||
|
op.drop_table('service_charges')
|
||
|
op.drop_table('recipes')
|
||
|
op.drop_table('settings')
|
||
|
op.drop_table('auth_login_history')
|
||
|
op.drop_table('auth_groups')
|
||
|
op.drop_table('msg_posts')
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
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_login_history',
|
||
|
sa.Column('login_history_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('user_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('client_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('date', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False),
|
||
|
sa.ForeignKeyConstraint(['client_id'], ['auth_clients.client_id'], name='auth_login_history_client_id_fkey'),
|
||
|
sa.ForeignKeyConstraint(['user_id'], ['auth_users.UserID'], name='auth_login_history_user_id_fkey'),
|
||
|
sa.PrimaryKeyConstraint('login_history_id', name='auth_login_history_pkey'),
|
||
|
sa.UniqueConstraint('user_id', 'client_id', 'date', name='auth_login_history_user_id_client_id_date_key')
|
||
|
)
|
||
|
op.create_table('settings',
|
||
|
sa.Column('SettingID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
||
|
sa.Column('Data', postgresql.BYTEA(), autoincrement=False, nullable=True),
|
||
|
sa.PrimaryKeyConstraint('SettingID', name='settings_pkey'),
|
||
|
sa.UniqueConstraint('Name', name='settings_Name_key')
|
||
|
)
|
||
|
op.create_table('recipes',
|
||
|
sa.Column('recipe_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('product_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('quantity', sa.NUMERIC(), autoincrement=False, nullable=False),
|
||
|
sa.Column('cost_price', sa.NUMERIC(), autoincrement=False, nullable=False),
|
||
|
sa.Column('sale_price', sa.NUMERIC(), autoincrement=False, nullable=False),
|
||
|
sa.Column('notes', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
|
||
|
sa.Column('valid_from', sa.DATE(), autoincrement=False, nullable=False),
|
||
|
sa.Column('valid_to', sa.DATE(), autoincrement=False, nullable=False),
|
||
|
sa.Column('effective_from', sa.DATE(), autoincrement=False, nullable=False),
|
||
|
sa.Column('effective_to', sa.DATE(), autoincrement=False, nullable=True),
|
||
|
sa.ForeignKeyConstraint(['product_id'], ['products.ProductID'], name='recipes_product_id_fkey'),
|
||
|
sa.PrimaryKeyConstraint('recipe_id', name='recipes_pkey'),
|
||
|
postgresql_ignore_search_path=False
|
||
|
)
|
||
|
op.create_table('service_charges',
|
||
|
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('voucher_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('journal_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('days_worked', sa.INTEGER(), autoincrement=False, nullable=False),
|
||
|
sa.Column('points', sa.NUMERIC(precision=5, scale=2), autoincrement=False, nullable=False),
|
||
|
sa.ForeignKeyConstraint(['journal_id'], ['journals.JournalID'], name='service_charges_journal_id_fkey'),
|
||
|
sa.ForeignKeyConstraint(['voucher_id'], ['vouchers.VoucherID'], name='service_charges_voucher_id_fkey'),
|
||
|
sa.PrimaryKeyConstraint('id', name='service_charges_pkey')
|
||
|
)
|
||
|
op.create_table('journals',
|
||
|
sa.Column('JournalID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('Debit', sa.INTEGER(), autoincrement=False, nullable=True),
|
||
|
sa.Column('Amount', sa.NUMERIC(), autoincrement=False, nullable=True),
|
||
|
sa.Column('VoucherID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('account_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('CostCentreID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.ForeignKeyConstraint(['CostCentreID'], ['cost_centres.CostCentreID'], name='entities_journals_CostCenterID_fkey'),
|
||
|
sa.ForeignKeyConstraint(['VoucherID'], ['vouchers.VoucherID'], name='journals_VoucherID_fkey'),
|
||
|
sa.ForeignKeyConstraint(['account_id'], ['accounts.id'], name='journals_account_id_fkey'),
|
||
|
sa.PrimaryKeyConstraint('JournalID', name='entities_journals_pkey'),
|
||
|
postgresql_ignore_search_path=False
|
||
|
)
|
||
|
op.create_index('ix_journals_VoucherID', 'journals', ['VoucherID'], unique=False)
|
||
|
op.create_table('batches',
|
||
|
sa.Column('BatchID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('Name', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
|
||
|
sa.Column('ProductID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('QuantityRemaining', sa.NUMERIC(), autoincrement=False, nullable=True),
|
||
|
sa.Column('Rate', sa.NUMERIC(), autoincrement=False, nullable=True),
|
||
|
sa.Column('Tax', sa.NUMERIC(), autoincrement=False, nullable=True),
|
||
|
sa.Column('Discount', sa.NUMERIC(), autoincrement=False, nullable=True),
|
||
|
sa.ForeignKeyConstraint(['ProductID'], ['products.ProductID'], name='batches_ProductID_fkey'),
|
||
|
sa.PrimaryKeyConstraint('BatchID', name='entities_batches_pkey'),
|
||
|
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_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('vouchers',
|
||
|
sa.Column('VoucherID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('date', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||
|
sa.Column('narration', sa.VARCHAR(length=1000), autoincrement=False, nullable=False),
|
||
|
sa.Column('creation_date', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False),
|
||
|
sa.Column('last_edit_date', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False),
|
||
|
sa.Column('voucher_type', sa.INTEGER(), autoincrement=False, nullable=False),
|
||
|
sa.Column('is_posted', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.Column('poster_id', postgresql.UUID(), autoincrement=False, nullable=True),
|
||
|
sa.Column('user_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('is_reconciled', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.Column('reconcile_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||
|
sa.Column('is_starred', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.ForeignKeyConstraint(['poster_id'], ['auth_users.UserID'], name='vouchers_poster_id_fkey'),
|
||
|
sa.ForeignKeyConstraint(['user_id'], ['auth_users.UserID'], name='vouchers_user_id_fkey'),
|
||
|
sa.PrimaryKeyConstraint('VoucherID', name='vouchers_pkey'),
|
||
|
postgresql_ignore_search_path=False
|
||
|
)
|
||
|
op.create_table('images',
|
||
|
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('resource_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('resource_type', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
||
|
sa.Column('image', postgresql.BYTEA(), autoincrement=False, nullable=False),
|
||
|
sa.Column('thumbnail', postgresql.BYTEA(), autoincrement=False, nullable=False),
|
||
|
sa.Column('creation_date', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False),
|
||
|
sa.PrimaryKeyConstraint('id', name='images_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('auth_roles',
|
||
|
sa.Column('RoleID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
|
||
|
sa.PrimaryKeyConstraint('RoleID', name='auth_roles_pkey'),
|
||
|
sa.UniqueConstraint('Name', name='auth_roles_Name_key')
|
||
|
)
|
||
|
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.create_table('auth_users',
|
||
|
sa.Column('UserID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
|
||
|
sa.Column('Password', sa.VARCHAR(length=60), autoincrement=False, nullable=True),
|
||
|
sa.Column('LockedOut', sa.BOOLEAN(), autoincrement=False, nullable=True),
|
||
|
sa.PrimaryKeyConstraint('UserID', name='auth_users_pkey'),
|
||
|
sa.UniqueConstraint('Name', name='auth_users_Name_key'),
|
||
|
postgresql_ignore_search_path=False
|
||
|
)
|
||
|
op.create_table('recipe_items',
|
||
|
sa.Column('recipe_item_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('recipe_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('product_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('quantity', sa.INTEGER(), autoincrement=False, nullable=False),
|
||
|
sa.Column('price', sa.INTEGER(), autoincrement=False, nullable=False),
|
||
|
sa.ForeignKeyConstraint(['product_id'], ['products.ProductID'], name='recipe_items_product_id_fkey'),
|
||
|
sa.ForeignKeyConstraint(['recipe_id'], ['recipes.recipe_id'], name='recipe_items_recipe_id_fkey'),
|
||
|
sa.PrimaryKeyConstraint('recipe_item_id', name='recipe_items_pkey'),
|
||
|
sa.UniqueConstraint('recipe_id', 'product_id', name='recipe_items_recipe_id_product_id_key')
|
||
|
)
|
||
|
op.create_table('accounts',
|
||
|
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('code', sa.INTEGER(), autoincrement=False, nullable=False),
|
||
|
sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
||
|
sa.Column('type', sa.INTEGER(), autoincrement=False, nullable=False),
|
||
|
sa.Column('account_type', sa.VARCHAR(length=50), autoincrement=False, nullable=False),
|
||
|
sa.Column('is_starred', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.Column('is_active', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.Column('is_reconcilable', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.Column('cost_centre_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('is_fixture', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.ForeignKeyConstraint(['cost_centre_id'], ['cost_centres.CostCentreID'], name='accounts_cost_centre_id_fkey'),
|
||
|
sa.PrimaryKeyConstraint('id', name='accounts_pkey'),
|
||
|
sa.UniqueConstraint('name', name='accounts_name_key'),
|
||
|
postgresql_ignore_search_path=False
|
||
|
)
|
||
|
op.create_table('product_groups',
|
||
|
sa.Column('ProductGroupID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
|
||
|
sa.Column('IsFixture', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.PrimaryKeyConstraint('ProductGroupID', name='entities_productgroups_pkey'),
|
||
|
sa.UniqueConstraint('Name', name='entities_productgroups_Name_key'),
|
||
|
postgresql_ignore_search_path=False
|
||
|
)
|
||
|
op.create_table('attendances',
|
||
|
sa.Column('AttendanceID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('EmployeeID', postgresql.UUID(), autoincrement=False, nullable=True),
|
||
|
sa.Column('Date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
|
||
|
sa.Column('AttendanceType', sa.INTEGER(), autoincrement=False, nullable=True),
|
||
|
sa.Column('Amount', sa.NUMERIC(), autoincrement=False, nullable=True),
|
||
|
sa.Column('CreationDate', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
|
||
|
sa.Column('UserID', postgresql.UUID(), autoincrement=False, nullable=True),
|
||
|
sa.Column('IsValid', sa.BOOLEAN(), autoincrement=False, nullable=True),
|
||
|
sa.ForeignKeyConstraint(['EmployeeID'], ['employees.id'], name='entities_attendances_EmployeeID_fkey'),
|
||
|
sa.ForeignKeyConstraint(['UserID'], ['auth_users.UserID'], name='entities_attendances_UserID_fkey'),
|
||
|
sa.PrimaryKeyConstraint('AttendanceID', name='entities_attendances_pkey')
|
||
|
)
|
||
|
op.create_table('cost_centres',
|
||
|
sa.Column('CostCentreID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
|
||
|
sa.Column('IsFixture', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.PrimaryKeyConstraint('CostCentreID', name='entities_costcenters_pkey'),
|
||
|
sa.UniqueConstraint('Name', name='entities_costcenters_Name_key'),
|
||
|
postgresql_ignore_search_path=False
|
||
|
)
|
||
|
op.create_table('products',
|
||
|
sa.Column('ProductID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('Code', sa.INTEGER(), autoincrement=False, nullable=True),
|
||
|
sa.Column('Name', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
||
|
sa.Column('Units', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
||
|
sa.Column('Fraction', sa.NUMERIC(), autoincrement=False, nullable=False),
|
||
|
sa.Column('FractionUnits', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
||
|
sa.Column('ProductYield', sa.NUMERIC(), autoincrement=False, nullable=False),
|
||
|
sa.Column('ProductGroupID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('account_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('cost_price', sa.NUMERIC(), autoincrement=False, nullable=False),
|
||
|
sa.Column('sale_price', sa.NUMERIC(), autoincrement=False, nullable=False),
|
||
|
sa.Column('IsActive', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.Column('IsFixture', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.Column('is_purchased', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.Column('is_sold', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.ForeignKeyConstraint(['ProductGroupID'], ['product_groups.ProductGroupID'], name='products_ProductGroupID_fkey'),
|
||
|
sa.ForeignKeyConstraint(['account_id'], ['accounts.id'], name='products_account_id_fkey'),
|
||
|
sa.PrimaryKeyConstraint('ProductID', name='products_pkey'),
|
||
|
sa.UniqueConstraint('Code', name='products_Code_key'),
|
||
|
sa.UniqueConstraint('Name', 'Units', name='products_Name_Units_key'),
|
||
|
postgresql_ignore_search_path=False
|
||
|
)
|
||
|
op.create_table('fingerprints',
|
||
|
sa.Column('FingerprintID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('EmployeeID', postgresql.UUID(), autoincrement=False, nullable=True),
|
||
|
sa.Column('Date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
|
||
|
sa.ForeignKeyConstraint(['EmployeeID'], ['employees.id'], name='entities_fingerprints_EmployeeID_fkey'),
|
||
|
sa.PrimaryKeyConstraint('FingerprintID', name='entities_fingerprints_pkey'),
|
||
|
sa.UniqueConstraint('EmployeeID', 'Date', name='uq_employee_id_date')
|
||
|
)
|
||
|
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('employees',
|
||
|
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('Designation', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
|
||
|
sa.Column('Salary', sa.INTEGER(), autoincrement=False, nullable=True),
|
||
|
sa.Column('ServicePoints', sa.NUMERIC(precision=5, scale=2), autoincrement=False, nullable=True),
|
||
|
sa.Column('JoiningDate', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
|
||
|
sa.Column('LeavingDate', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
|
||
|
sa.ForeignKeyConstraint(['id'], ['accounts.id'], name='employees_id_fkey'),
|
||
|
sa.PrimaryKeyConstraint('id', name='entities_employees_pkey')
|
||
|
)
|
||
|
op.create_table('inventories',
|
||
|
sa.Column('InventoryID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('VoucherID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('ProductID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('BatchID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('Quantity', sa.NUMERIC(), autoincrement=False, nullable=True),
|
||
|
sa.Column('Rate', sa.NUMERIC(), autoincrement=False, nullable=True),
|
||
|
sa.Column('Tax', sa.NUMERIC(), autoincrement=False, nullable=True),
|
||
|
sa.Column('Discount', sa.NUMERIC(), autoincrement=False, nullable=True),
|
||
|
sa.ForeignKeyConstraint(['BatchID'], ['batches.BatchID'], name='entities_inventories_BatchID_fkey'),
|
||
|
sa.ForeignKeyConstraint(['ProductID'], ['products.ProductID'], name='inventories_ProductID_fkey'),
|
||
|
sa.ForeignKeyConstraint(['VoucherID'], ['vouchers.VoucherID'], name='inventories_VoucherID_fkey'),
|
||
|
sa.PrimaryKeyConstraint('InventoryID', name='entities_inventories_pkey')
|
||
|
)
|
||
|
op.create_index('ix_inventories_VoucherID', 'inventories', ['VoucherID'], unique=False)
|
||
|
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('auth_clients',
|
||
|
sa.Column('client_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('code', sa.INTEGER(), autoincrement=False, nullable=False),
|
||
|
sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
||
|
sa.Column('enabled', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||
|
sa.Column('otp', sa.INTEGER(), autoincrement=False, nullable=True),
|
||
|
sa.Column('creation_date', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False),
|
||
|
sa.PrimaryKeyConstraint('client_id', name='auth_clients_pkey'),
|
||
|
sa.UniqueConstraint('code', name='auth_clients_Code_key'),
|
||
|
sa.UniqueConstraint('name', name='auth_clients_Name_key')
|
||
|
)
|
||
|
op.create_table('salary_deductions',
|
||
|
sa.Column('SalaryDeductionID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('VoucherID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('JournalID', postgresql.UUID(), autoincrement=False, nullable=False),
|
||
|
sa.Column('GrossSalary', sa.INTEGER(), autoincrement=False, nullable=True),
|
||
|
sa.Column('DaysWorked', sa.INTEGER(), autoincrement=False, nullable=True),
|
||
|
sa.Column('EsiEmployee', sa.INTEGER(), autoincrement=False, nullable=True),
|
||
|
sa.Column('PfEmployee', sa.INTEGER(), autoincrement=False, nullable=True),
|
||
|
sa.Column('EsiEmployer', sa.INTEGER(), autoincrement=False, nullable=True),
|
||
|
sa.Column('PfEmployer', sa.INTEGER(), autoincrement=False, nullable=True),
|
||
|
sa.ForeignKeyConstraint(['JournalID'], ['journals.JournalID'], name='entities_salarydeductions_JournalID_fkey'),
|
||
|
sa.ForeignKeyConstraint(['VoucherID'], ['vouchers.VoucherID'], name='salary_deductions_VoucherID_fkey'),
|
||
|
sa.PrimaryKeyConstraint('SalaryDeductionID', name='entities_salarydeductions_pkey')
|
||
|
)
|
||
|
# ### end Alembic commands ###
|