"""init database

Revision ID: 60e58d3a26fa
Revises: 
Create Date: 2021-11-24 18:06:53.935899

"""
from alembic import op
import sqlalchemy as sa
import sqlmodel


# revision identifiers, used by Alembic.
revision = '60e58d3a26fa'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('address',
    sa.Column('street_name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('house_number', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('city', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('zip_code', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('id', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_address_city'), 'address', ['city'], unique=False)
    op.create_index(op.f('ix_address_house_number'), 'address', ['house_number'], unique=False)
    op.create_index(op.f('ix_address_id'), 'address', ['id'], unique=False)
    op.create_index(op.f('ix_address_street_name'), 'address', ['street_name'], unique=False)
    op.create_index(op.f('ix_address_zip_code'), 'address', ['zip_code'], unique=False)
    op.create_table('product',
    sa.Column('name', sa.String(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_index(op.f('ix_product_id'), 'product', ['id'], unique=False)
    op.create_table('customer',
    sa.Column('mobile_number', sa.String(), nullable=True),
    sa.Column('email', sa.String(), nullable=True),
    sa.Column('first_name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('last_name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('birth_date', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('gender', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('id', sa.Integer(), nullable=True),
    sa.Column('address_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['address_id'], ['address.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('mobile_number')
    )
    op.create_index(op.f('ix_customer_address_id'), 'customer', ['address_id'], unique=False)
    op.create_index(op.f('ix_customer_birth_date'), 'customer', ['birth_date'], unique=False)
    op.create_index(op.f('ix_customer_first_name'), 'customer', ['first_name'], unique=False)
    op.create_index(op.f('ix_customer_gender'), 'customer', ['gender'], unique=False)
    op.create_index(op.f('ix_customer_id'), 'customer', ['id'], unique=False)
    op.create_index(op.f('ix_customer_last_name'), 'customer', ['last_name'], unique=False)
    op.create_table('customerproductlink',
    sa.Column('customer_id', sa.Integer(), nullable=True),
    sa.Column('product_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['customer_id'], ['customer.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['product.id'], ),
    sa.PrimaryKeyConstraint('customer_id', 'product_id')
    )
    op.create_index(op.f('ix_customerproductlink_customer_id'), 'customerproductlink', ['customer_id'], unique=False)
    op.create_index(op.f('ix_customerproductlink_product_id'), 'customerproductlink', ['product_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_customerproductlink_product_id'), table_name='customerproductlink')
    op.drop_index(op.f('ix_customerproductlink_customer_id'), table_name='customerproductlink')
    op.drop_table('customerproductlink')
    op.drop_index(op.f('ix_customer_last_name'), table_name='customer')
    op.drop_index(op.f('ix_customer_id'), table_name='customer')
    op.drop_index(op.f('ix_customer_gender'), table_name='customer')
    op.drop_index(op.f('ix_customer_first_name'), table_name='customer')
    op.drop_index(op.f('ix_customer_birth_date'), table_name='customer')
    op.drop_index(op.f('ix_customer_address_id'), table_name='customer')
    op.drop_table('customer')
    op.drop_index(op.f('ix_product_id'), table_name='product')
    op.drop_table('product')
    op.drop_index(op.f('ix_address_zip_code'), table_name='address')
    op.drop_index(op.f('ix_address_street_name'), table_name='address')
    op.drop_index(op.f('ix_address_id'), table_name='address')
    op.drop_index(op.f('ix_address_house_number'), table_name='address')
    op.drop_index(op.f('ix_address_city'), table_name='address')
    op.drop_table('address')
    # ### end Alembic commands ###

sqlmodel.sql.sqltypes.AutoString sqlalchemy.Integer alembic.op.drop_table sqlalchemy.UniqueConstraint sqlalchemy.PrimaryKeyConstraint alembic.op.f sqlalchemy.String sqlalchemy.ForeignKeyConstraint
[((3717, 3753), 'alembic.op.drop_table', 'op.drop_table', (['"""customerproductlink"""'], {}), "('customerproductlink')\n", (3730, 3753), False, 'from alembic import op\n'), ((4183, 4208), 'alembic.op.drop_table', 'op.drop_table', (['"""customer"""'], {}), "('customer')\n", (4196, 4208), False, 'from alembic import op\n'), ((4276, 4300), 'alembic.op.drop_table', 'op.drop_table', (['"""product"""'], {}), "('product')\n", (4289, 4300), False, 'from alembic import op\n'), ((4647, 4671), 'alembic.op.drop_table', 'op.drop_table', (['"""address"""'], {}), "('address')\n", (4660, 4671), False, 'from alembic import op\n'), ((778, 807), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""id"""'], {}), "('id')\n", (801, 807), True, 'import sqlalchemy as sa\n'), ((834, 857), 'alembic.op.f', 'op.f', (['"""ix_address_city"""'], {}), "('ix_address_city')\n", (838, 857), False, 'from alembic import op\n'), ((914, 945), 'alembic.op.f', 'op.f', (['"""ix_address_house_number"""'], {}), "('ix_address_house_number')\n", (918, 945), False, 'from alembic import op\n'), ((1010, 1031), 'alembic.op.f', 'op.f', (['"""ix_address_id"""'], {}), "('ix_address_id')\n", (1014, 1031), False, 'from alembic import op\n'), ((1086, 1116), 'alembic.op.f', 'op.f', (['"""ix_address_street_name"""'], {}), "('ix_address_street_name')\n", (1090, 1116), False, 'from alembic import op\n'), ((1180, 1207), 'alembic.op.f', 'op.f', (['"""ix_address_zip_code"""'], {}), "('ix_address_zip_code')\n", (1184, 1207), False, 'from alembic import op\n'), ((1384, 1413), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""id"""'], {}), "('id')\n", (1407, 1413), True, 'import sqlalchemy as sa\n'), ((1419, 1446), 'sqlalchemy.UniqueConstraint', 'sa.UniqueConstraint', (['"""name"""'], {}), "('name')\n", (1438, 1446), True, 'import sqlalchemy as sa\n'), ((1473, 1494), 'alembic.op.f', 'op.f', (['"""ix_product_id"""'], {}), "('ix_product_id')\n", (1477, 1494), False, 'from alembic import op\n'), ((2104, 2159), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['address_id']", "['address.id']"], {}), "(['address_id'], ['address.id'])\n", (2127, 2159), True, 'import sqlalchemy as sa\n'), ((2167, 2196), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""id"""'], {}), "('id')\n", (2190, 2196), True, 'import sqlalchemy as sa\n'), ((2202, 2230), 'sqlalchemy.UniqueConstraint', 'sa.UniqueConstraint', (['"""email"""'], {}), "('email')\n", (2221, 2230), True, 'import sqlalchemy as sa\n'), ((2236, 2272), 'sqlalchemy.UniqueConstraint', 'sa.UniqueConstraint', (['"""mobile_number"""'], {}), "('mobile_number')\n", (2255, 2272), True, 'import sqlalchemy as sa\n'), ((2299, 2329), 'alembic.op.f', 'op.f', (['"""ix_customer_address_id"""'], {}), "('ix_customer_address_id')\n", (2303, 2329), False, 'from alembic import op\n'), ((2393, 2423), 'alembic.op.f', 'op.f', (['"""ix_customer_birth_date"""'], {}), "('ix_customer_birth_date')\n", (2397, 2423), False, 'from alembic import op\n'), ((2487, 2517), 'alembic.op.f', 'op.f', (['"""ix_customer_first_name"""'], {}), "('ix_customer_first_name')\n", (2491, 2517), False, 'from alembic import op\n'), ((2581, 2607), 'alembic.op.f', 'op.f', (['"""ix_customer_gender"""'], {}), "('ix_customer_gender')\n", (2585, 2607), False, 'from alembic import op\n'), ((2667, 2689), 'alembic.op.f', 'op.f', (['"""ix_customer_id"""'], {}), "('ix_customer_id')\n", (2671, 2689), False, 'from alembic import op\n'), ((2745, 2774), 'alembic.op.f', 'op.f', (['"""ix_customer_last_name"""'], {}), "('ix_customer_last_name')\n", (2749, 2774), False, 'from alembic import op\n'), ((2981, 3038), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['customer_id']", "['customer.id']"], {}), "(['customer_id'], ['customer.id'])\n", (3004, 3038), True, 'import sqlalchemy as sa\n'), ((3046, 3101), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['product_id']", "['product.id']"], {}), "(['product_id'], ['product.id'])\n", (3069, 3101), True, 'import sqlalchemy as sa\n'), ((3109, 3161), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""customer_id"""', '"""product_id"""'], {}), "('customer_id', 'product_id')\n", (3132, 3161), True, 'import sqlalchemy as sa\n'), ((3188, 3230), 'alembic.op.f', 'op.f', (['"""ix_customerproductlink_customer_id"""'], {}), "('ix_customerproductlink_customer_id')\n", (3192, 3230), False, 'from alembic import op\n'), ((3306, 3347), 'alembic.op.f', 'op.f', (['"""ix_customerproductlink_product_id"""'], {}), "('ix_customerproductlink_product_id')\n", (3310, 3347), False, 'from alembic import op\n'), ((3540, 3581), 'alembic.op.f', 'op.f', (['"""ix_customerproductlink_product_id"""'], {}), "('ix_customerproductlink_product_id')\n", (3544, 3581), False, 'from alembic import op\n'), ((3635, 3677), 'alembic.op.f', 'op.f', (['"""ix_customerproductlink_customer_id"""'], {}), "('ix_customerproductlink_customer_id')\n", (3639, 3677), False, 'from alembic import op\n'), ((3772, 3801), 'alembic.op.f', 'op.f', (['"""ix_customer_last_name"""'], {}), "('ix_customer_last_name')\n", (3776, 3801), False, 'from alembic import op\n'), ((3844, 3866), 'alembic.op.f', 'op.f', (['"""ix_customer_id"""'], {}), "('ix_customer_id')\n", (3848, 3866), False, 'from alembic import op\n'), ((3909, 3935), 'alembic.op.f', 'op.f', (['"""ix_customer_gender"""'], {}), "('ix_customer_gender')\n", (3913, 3935), False, 'from alembic import op\n'), ((3978, 4008), 'alembic.op.f', 'op.f', (['"""ix_customer_first_name"""'], {}), "('ix_customer_first_name')\n", (3982, 4008), False, 'from alembic import op\n'), ((4051, 4081), 'alembic.op.f', 'op.f', (['"""ix_customer_birth_date"""'], {}), "('ix_customer_birth_date')\n", (4055, 4081), False, 'from alembic import op\n'), ((4124, 4154), 'alembic.op.f', 'op.f', (['"""ix_customer_address_id"""'], {}), "('ix_customer_address_id')\n", (4128, 4154), False, 'from alembic import op\n'), ((4227, 4248), 'alembic.op.f', 'op.f', (['"""ix_product_id"""'], {}), "('ix_product_id')\n", (4231, 4248), False, 'from alembic import op\n'), ((4319, 4346), 'alembic.op.f', 'op.f', (['"""ix_address_zip_code"""'], {}), "('ix_address_zip_code')\n", (4323, 4346), False, 'from alembic import op\n'), ((4388, 4418), 'alembic.op.f', 'op.f', (['"""ix_address_street_name"""'], {}), "('ix_address_street_name')\n", (4392, 4418), False, 'from alembic import op\n'), ((4460, 4481), 'alembic.op.f', 'op.f', (['"""ix_address_id"""'], {}), "('ix_address_id')\n", (4464, 4481), False, 'from alembic import op\n'), ((4523, 4554), 'alembic.op.f', 'op.f', (['"""ix_address_house_number"""'], {}), "('ix_address_house_number')\n", (4527, 4554), False, 'from alembic import op\n'), ((4596, 4619), 'alembic.op.f', 'op.f', (['"""ix_address_city"""'], {}), "('ix_address_city')\n", (4600, 4619), False, 'from alembic import op\n'), ((434, 468), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (466, 468), False, 'import sqlmodel\n'), ((517, 551), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (549, 551), False, 'import sqlmodel\n'), ((592, 626), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (624, 626), False, 'import sqlmodel\n'), ((671, 705), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (703, 705), False, 'import sqlmodel\n'), ((744, 756), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (754, 756), True, 'import sqlalchemy as sa\n'), ((1301, 1312), 'sqlalchemy.String', 'sa.String', ([], {}), '()\n', (1310, 1312), True, 'import sqlalchemy as sa\n'), ((1350, 1362), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (1360, 1362), True, 'import sqlalchemy as sa\n'), ((1592, 1603), 'sqlalchemy.String', 'sa.String', ([], {}), '()\n', (1601, 1603), True, 'import sqlalchemy as sa\n'), ((1644, 1655), 'sqlalchemy.String', 'sa.String', ([], {}), '()\n', (1653, 1655), True, 'import sqlalchemy as sa\n'), ((1701, 1735), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1733, 1735), False, 'import sqlmodel\n'), ((1781, 1815), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1813, 1815), False, 'import sqlmodel\n'), ((1862, 1896), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1894, 1896), False, 'import sqlmodel\n'), ((1939, 1973), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1971, 1973), False, 'import sqlmodel\n'), ((2012, 2024), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (2022, 2024), True, 'import sqlalchemy as sa\n'), ((2070, 2082), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (2080, 2082), True, 'import sqlalchemy as sa\n'), ((2889, 2901), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (2899, 2901), True, 'import sqlalchemy as sa\n'), ((2947, 2959), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (2957, 2959), True, 'import sqlalchemy as sa\n')]