75 lines
2.6 KiB
Python
75 lines
2.6 KiB
Python
|
"""Initial configuration
|
||
|
|
||
|
Revision ID: 354676f60be
|
||
|
Revises: None
|
||
|
Create Date: 2015-06-04 17:17:28.933840
|
||
|
|
||
|
"""
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = '354676f60be'
|
||
|
down_revision = None
|
||
|
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
|
||
|
|
||
|
def upgrade():
|
||
|
### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table('location',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('name', sa.String(length=120), nullable=True),
|
||
|
sa.Column('address', sa.String(length=254), nullable=True),
|
||
|
sa.Column('website', sa.String(length=120), nullable=True),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
op.create_table('user',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('username', sa.String(length=80), nullable=True),
|
||
|
sa.Column('admin', sa.Boolean(), nullable=True),
|
||
|
sa.Column('bias', sa.Integer(), nullable=True),
|
||
|
sa.PrimaryKeyConstraint('id'),
|
||
|
sa.UniqueConstraint('username')
|
||
|
)
|
||
|
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=True),
|
||
|
sa.Column('price', sa.Integer(), nullable=True),
|
||
|
sa.ForeignKeyConstraint(['location_id'], ['location.id'], ),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
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),
|
||
|
sa.ForeignKeyConstraint(['courrier_id'], ['user.id'], ),
|
||
|
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),
|
||
|
sa.Column('order_id', sa.Integer(), nullable=True),
|
||
|
sa.Column('product_id', sa.Integer(), nullable=True),
|
||
|
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')
|
||
|
)
|
||
|
### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade():
|
||
|
### commands auto generated by Alembic - please adjust! ###
|
||
|
op.drop_table('order_item')
|
||
|
op.drop_table('order')
|
||
|
op.drop_table('product')
|
||
|
op.drop_table('user')
|
||
|
op.drop_table('location')
|
||
|
### end Alembic commands ###
|