You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
3.4 KiB
Python
76 lines
3.4 KiB
Python
7 years ago
|
"""Cookie Domain Model
|
||
|
|
||
|
Revision ID: 374c36260db7
|
||
|
Revises: 710505cf5d4c
|
||
|
Create Date: 2018-06-10 17:39:18.891568
|
||
|
|
||
|
"""
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = '374c36260db7'
|
||
|
down_revision = '710505cf5d4c'
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table('cookies',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('created_date', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"), nullable=True),
|
||
|
sa.Column('modified_date', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"), nullable=True),
|
||
|
sa.Column('name', sa.String(length=50), nullable=True),
|
||
|
sa.Column('recipe_url', sa.String(length=255), nullable=True),
|
||
|
sa.Column('sku', sa.String(length=55), nullable=True),
|
||
|
sa.Column('qoh', sa.Integer(), nullable=True),
|
||
|
sa.Column('unit_cost', sa.Numeric(precision=12, scale=2), nullable=True),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
op.create_index(op.f('ix_cookies_name'), 'cookies', ['name'], unique=False)
|
||
|
op.create_table('users',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('created_date', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"), nullable=True),
|
||
|
sa.Column('modified_date', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"), nullable=True),
|
||
|
sa.Column('email', sa.String(length=255), nullable=False),
|
||
|
sa.Column('password', sa.String(length=255), nullable=True),
|
||
|
sa.Column('admin', sa.Boolean(), nullable=False),
|
||
|
sa.Column('confirmed', sa.Boolean(), nullable=False),
|
||
|
sa.PrimaryKeyConstraint('id'),
|
||
|
sa.UniqueConstraint('email')
|
||
|
)
|
||
|
op.create_table('orders',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('created_date', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"), nullable=True),
|
||
|
sa.Column('modified_date', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"), nullable=True),
|
||
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
||
|
sa.Column('shipped', sa.Boolean(), nullable=True),
|
||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
op.create_table('line_items',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('created_date', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"), nullable=True),
|
||
|
sa.Column('modified_date', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"), nullable=True),
|
||
|
sa.Column('order_id', sa.Integer(), nullable=False),
|
||
|
sa.Column('cookie_id', sa.Integer(), nullable=False),
|
||
|
sa.Column('quantity', sa.Integer(), nullable=True),
|
||
|
sa.Column('extended_cost', sa.Numeric(precision=12, scale=2), nullable=True),
|
||
|
sa.ForeignKeyConstraint(['cookie_id'], ['cookies.id'], ),
|
||
|
sa.ForeignKeyConstraint(['order_id'], ['orders.id'], ),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.drop_table('line_items')
|
||
|
op.drop_table('orders')
|
||
|
op.drop_table('users')
|
||
|
op.drop_index(op.f('ix_cookies_name'), table_name='cookies')
|
||
|
op.drop_table('cookies')
|
||
|
# ### end Alembic commands ###
|