Update Models and Schema

This commit is contained in:
2022-07-12 06:32:03 -07:00
parent 57c9c70cbb
commit f7e93e7098
7 changed files with 317 additions and 63 deletions

View File

@@ -0,0 +1,108 @@
"""empty message
Revision ID: 938218f911e8
Revises:
Create Date: 2022-07-12 06:31:18.835124
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '938218f911e8'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('access_keys',
sa.Column('key', sa.String(length=64), nullable=False),
sa.Column('clientId', sa.String(length=64), nullable=False),
sa.Column('clientIP', sa.String(length=46), nullable=False),
sa.Column('userAgent', sa.String(length=255), nullable=False),
sa.Column('suspended', sa.Boolean(), nullable=False),
sa.Column('revoked', sa.Boolean(), nullable=False),
sa.Column('createdAt', sa.DateTime(), nullable=True),
sa.Column('suspendedAt', sa.DateTime(), nullable=True),
sa.Column('revokedAt', sa.DateTime(), nullable=True),
sa.Column('restoredAt', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('key')
)
op.create_table('access_tokens',
sa.Column('token', sa.String(length=64), nullable=False),
sa.Column('clientIP', sa.String(length=46), nullable=False),
sa.Column('userAgent', sa.String(length=255), nullable=False),
sa.Column('expired', sa.Boolean(), nullable=False),
sa.Column('revoked', sa.Boolean(), nullable=False),
sa.Column('issuedAt', sa.DateTime(), nullable=True),
sa.Column('expiresAt', sa.DateTime(), nullable=True),
sa.Column('revokedAt', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('token')
)
op.create_table('lists',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('accessKey', sa.String(length=64), nullable=True),
sa.Column('name', sa.String(length=128), nullable=False),
sa.Column('notes', sa.String(), nullable=True),
sa.Column('createdAt', sa.DateTime(), nullable=True),
sa.Column('modifiedAt', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('products',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('accessKey', sa.String(length=64), nullable=True),
sa.Column('name', sa.String(length=128), nullable=False),
sa.Column('category', sa.String(length=128), nullable=False),
sa.Column('notes', sa.String(), nullable=True),
sa.Column('createdAt', sa.DateTime(), nullable=True),
sa.Column('modifiedAt', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_products_category'), 'products', ['category'], unique=False)
op.create_table('sigl_config',
sa.Column('key', sa.String(), nullable=False),
sa.Column('value', sa.String(length=128), nullable=True),
sa.PrimaryKeyConstraint('key')
)
op.create_table('list_entries',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('list_id', sa.Integer(), nullable=False),
sa.Column('product_id', sa.Integer(), nullable=False),
sa.Column('quantity', sa.String(length=128), nullable=True),
sa.Column('crossedOff', sa.Boolean(), nullable=True),
sa.Column('deleted', sa.Boolean(), nullable=True),
sa.Column('notes', sa.String(), nullable=True),
sa.Column('createdAt', sa.DateTime(), nullable=True),
sa.Column('modifiedAt', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['list_id'], ['lists.id'], ),
sa.ForeignKeyConstraint(['product_id'], ['products.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('product_locations',
sa.Column('product_id', sa.Integer(), nullable=False),
sa.Column('store', sa.String(length=128), nullable=False),
sa.Column('aisle', sa.String(length=64), nullable=False),
sa.Column('bin', sa.String(length=64), nullable=True),
sa.Column('notes', sa.String(), nullable=True),
sa.Column('createdAt', sa.DateTime(), nullable=True),
sa.Column('modifiedAt', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['product_id'], ['products.id'], ),
sa.PrimaryKeyConstraint('product_id', 'store')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('product_locations')
op.drop_table('list_entries')
op.drop_table('sigl_config')
op.drop_index(op.f('ix_products_category'), table_name='products')
op.drop_table('products')
op.drop_table('lists')
op.drop_table('access_tokens')
op.drop_table('access_keys')
# ### end Alembic commands ###

View File

@@ -1,56 +0,0 @@
"""empty message
Revision ID: b3639db87e06
Revises:
Create Date: 2022-07-11 17:09:20.502213
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b3639db87e06'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('products',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=128), nullable=False),
sa.Column('category', sa.String(length=128), nullable=False),
sa.Column('notes', sa.String(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('modified_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_products_category'), 'products', ['category'], unique=False)
op.create_table('sigl_config',
sa.Column('key', sa.String(), nullable=False),
sa.Column('value', sa.String(length=128), nullable=True),
sa.PrimaryKeyConstraint('key')
)
op.create_table('product_locations',
sa.Column('product_id', sa.Integer(), nullable=False),
sa.Column('store', sa.String(length=128), nullable=False),
sa.Column('aisle', sa.String(length=64), nullable=False),
sa.Column('bin', sa.String(length=64), nullable=True),
sa.Column('notes', sa.String(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('modified_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['product_id'], ['products.id'], ),
sa.PrimaryKeyConstraint('product_id', 'store')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('product_locations')
op.drop_table('sigl_config')
op.drop_index(op.f('ix_products_category'), table_name='products')
op.drop_table('products')
# ### end Alembic commands ###