2019-04-02 18:03:14 +02:00
|
|
|
"""empty message
|
2015-06-04 17:29:37 +02:00
|
|
|
|
2019-04-02 18:03:14 +02:00
|
|
|
Revision ID: 150252c1cdb1
|
2015-06-04 17:29:37 +02:00
|
|
|
Revises: None
|
2019-04-02 18:03:14 +02:00
|
|
|
Create Date: 2019-04-02 18:00:12.618368
|
2015-06-04 17:29:37 +02:00
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
2019-04-02 18:03:14 +02:00
|
|
|
revision = '150252c1cdb1'
|
2015-06-04 17:29:37 +02:00
|
|
|
down_revision = None
|
|
|
|
|
|
|
|
from alembic import op
|
|
|
|
import sqlalchemy as sa
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
2019-04-02 18:03:14 +02:00
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
2015-06-04 17:29:37 +02:00
|
|
|
op.create_table('location',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
2019-04-02 18:03:14 +02:00
|
|
|
sa.Column('name', sa.String(length=120), nullable=False),
|
2015-06-04 17:29:37 +02:00
|
|
|
sa.Column('address', sa.String(length=254), nullable=True),
|
|
|
|
sa.Column('website', sa.String(length=120), nullable=True),
|
2019-04-02 18:03:14 +02:00
|
|
|
sa.Column('telephone', sa.String(length=20), nullable=True),
|
2015-06-04 17:29:37 +02:00
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
|
|
|
op.create_table('user',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
2019-04-02 18:03:14 +02:00
|
|
|
sa.Column('username', sa.String(length=80), nullable=False),
|
2015-06-04 17:29:37 +02:00
|
|
|
sa.Column('admin', sa.Boolean(), nullable=True),
|
|
|
|
sa.Column('bias', sa.Integer(), nullable=True),
|
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.UniqueConstraint('username')
|
|
|
|
)
|
|
|
|
op.create_table('order',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('courrier_id', sa.Integer(), nullable=True),
|
|
|
|
sa.Column('location_id', sa.Integer(), nullable=True),
|
|
|
|
sa.Column('starttime', sa.DateTime(), nullable=True),
|
|
|
|
sa.Column('stoptime', sa.DateTime(), nullable=True),
|
|
|
|
sa.Column('public', sa.Boolean(), nullable=True),
|
2019-04-02 18:03:14 +02:00
|
|
|
sa.ForeignKeyConstraint(['location_id'], ['location.id'], ),
|
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
|
|
|
op.create_table('product',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('location_id', sa.Integer(), nullable=True),
|
|
|
|
sa.Column('name', sa.String(length=120), nullable=False),
|
|
|
|
sa.Column('price', sa.Integer(), nullable=False),
|
2015-06-04 17:29:37 +02:00
|
|
|
sa.ForeignKeyConstraint(['location_id'], ['location.id'], ),
|
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
|
|
|
op.create_table('order_item',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
2019-04-02 18:03:14 +02:00
|
|
|
sa.Column('order_id', sa.Integer(), nullable=False),
|
2015-06-04 17:29:37 +02:00
|
|
|
sa.Column('product_id', sa.Integer(), nullable=True),
|
2019-04-02 18:03:14 +02:00
|
|
|
sa.Column('paid', sa.Boolean(), nullable=True),
|
|
|
|
sa.Column('extra', sa.String(length=254), nullable=True),
|
2015-06-04 17:29:37 +02:00
|
|
|
sa.Column('name', sa.String(length=120), nullable=True),
|
|
|
|
sa.ForeignKeyConstraint(['order_id'], ['order.id'], ),
|
|
|
|
sa.ForeignKeyConstraint(['product_id'], ['product.id'], ),
|
|
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
2019-04-02 18:03:14 +02:00
|
|
|
# ### end Alembic commands ###
|
2015-06-04 17:29:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
2019-04-02 18:03:14 +02:00
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
2015-06-04 17:29:37 +02:00
|
|
|
op.drop_table('order_item')
|
|
|
|
op.drop_table('product')
|
2019-04-02 18:03:14 +02:00
|
|
|
op.drop_table('order')
|
2015-06-04 17:29:37 +02:00
|
|
|
op.drop_table('user')
|
|
|
|
op.drop_table('location')
|
2019-04-02 18:03:14 +02:00
|
|
|
# ### end Alembic commands ###
|