Due to update to sqlalchemy, fixed schema nullability
This commit is contained in:
@ -2,7 +2,7 @@ import logging
|
||||
|
||||
from alembic import context
|
||||
from barker.core.config import settings
|
||||
from barker.db.base import User
|
||||
from barker.db.base import reg
|
||||
from sqlalchemy import create_engine, pool
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ logging.getLogger("alembic").setLevel(settings.ALEMBIC_LOG_LEVEL)
|
||||
# This line sets up loggers basically.
|
||||
|
||||
|
||||
target_metadata = User.metadata
|
||||
target_metadata = reg.metadata
|
||||
|
||||
# other values from the config, defined by the needs of env.py,
|
||||
# can be acquired:
|
||||
|
||||
39
barker/alembic/versions/f135019a4ebf_fix_nullability.py
Normal file
39
barker/alembic/versions/f135019a4ebf_fix_nullability.py
Normal file
@ -0,0 +1,39 @@
|
||||
"""fix nullability
|
||||
|
||||
Revision ID: f135019a4ebf
|
||||
Revises: 0e326930b8a4
|
||||
Create Date: 2023-02-22 03:41:23.537388
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "f135019a4ebf"
|
||||
down_revision = "0e326930b8a4"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column("inventories", "quantity", existing_type=sa.NUMERIC(precision=15, scale=2), nullable=False)
|
||||
op.alter_column("inventories", "price", existing_type=sa.NUMERIC(precision=15, scale=2), nullable=False)
|
||||
op.alter_column("inventories", "tax_rate", existing_type=sa.NUMERIC(precision=15, scale=5), nullable=False)
|
||||
op.alter_column("inventories", "discount", existing_type=sa.NUMERIC(precision=15, scale=5), nullable=False)
|
||||
op.alter_column("permissions", "name", existing_type=sa.VARCHAR(length=255), nullable=False)
|
||||
op.alter_column("roles", "name", existing_type=sa.VARCHAR(length=255), nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column("roles", "name", existing_type=sa.VARCHAR(length=255), nullable=True)
|
||||
op.alter_column("permissions", "name", existing_type=sa.VARCHAR(length=255), nullable=True)
|
||||
op.alter_column("inventories", "discount", existing_type=sa.NUMERIC(precision=15, scale=5), nullable=True)
|
||||
op.alter_column("inventories", "tax_rate", existing_type=sa.NUMERIC(precision=15, scale=5), nullable=True)
|
||||
op.alter_column("inventories", "price", existing_type=sa.NUMERIC(precision=15, scale=2), nullable=True)
|
||||
op.alter_column("inventories", "quantity", existing_type=sa.NUMERIC(precision=15, scale=2), nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user