Fixed migrations and dev requirements
parent
e67b099e89
commit
3ef86bca1e
@ -0,0 +1,4 @@
|
||||
alembic
|
||||
pytest
|
||||
pytest-cov
|
||||
tox
|
@ -1,28 +0,0 @@
|
||||
"""initial models
|
||||
|
||||
Revision ID: 227892845cde
|
||||
Revises:
|
||||
Create Date: 2018-01-15 14:58:17.931063
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '227892845cde'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
@ -0,0 +1,75 @@
|
||||
"""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 ###
|
@ -0,0 +1,24 @@
|
||||
"""Empty Init
|
||||
|
||||
Revision ID: 710505cf5d4c
|
||||
Revises:
|
||||
Create Date: 2018-06-10 17:31:37.014032
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '710505cf5d4c'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
|
||||
|
||||
def downgrade():
|
||||
pass
|
@ -1,67 +0,0 @@
|
||||
"""Changed Datetimes to be UTC
|
||||
|
||||
Revision ID: 7eb9aabef1dc
|
||||
Revises: 82595a1e5193
|
||||
Create Date: 2018-05-07 13:59:32.923484
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7eb9aabef1dc'
|
||||
down_revision = '82595a1e5193'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column(
|
||||
table_name='cookies',
|
||||
column_name='created_date',
|
||||
type_=sa.DateTime(timezone=True)
|
||||
)
|
||||
op.alter_column(
|
||||
table_name='cookies',
|
||||
column_name='modified_date',
|
||||
type_=sa.DateTime(timezone=True)
|
||||
)
|
||||
op.alter_column(
|
||||
table_name='users',
|
||||
column_name='created_date',
|
||||
type_=sa.DateTime(timezone=True)
|
||||
)
|
||||
op.alter_column(
|
||||
table_name='users',
|
||||
column_name='modified_date',
|
||||
type_=sa.DateTime(timezone=True)
|
||||
)
|
||||
op.alter_column(
|
||||
table_name='orders',
|
||||
column_name='created_date',
|
||||
type_=sa.DateTime(timezone=True)
|
||||
)
|
||||
op.alter_column(
|
||||
table_name='orders',
|
||||
column_name='modified_date',
|
||||
type_=sa.DateTime(timezone=True)
|
||||
)
|
||||
op.alter_column(
|
||||
table_name='line_items',
|
||||
column_name='created_date',
|
||||
type_=sa.DateTime(timezone=True)
|
||||
)
|
||||
op.alter_column(
|
||||
table_name='line_items',
|
||||
column_name='modified_date',
|
||||
type_=sa.DateTime(timezone=True)
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
@ -1,30 +0,0 @@
|
||||
"""Added confirmed to user
|
||||
|
||||
Revision ID: 82595a1e5193
|
||||
Revises: 227892845cde
|
||||
Create Date: 2018-01-15 15:34:46.028181
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '82595a1e5193'
|
||||
down_revision = '227892845cde'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('confirmed', sa.Boolean()))
|
||||
op.execute('UPDATE users SET confirmed=FALSE')
|
||||
op.alter_column('users', 'confirmed', nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'confirmed')
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in New Issue