Review the ORM models and align the live database with them #16
1 changed files with 39 additions and 0 deletions
Make grids.side_length not nullable
The ORM always defined `Grid.side_length` with `nullable=False`, but the migration that created the "grids" table did not; the live database contains no `NULL`s.
commit
2a627072d8
|
|
@ -0,0 +1,39 @@
|
|||
"""Make `grids.side_length` not nullable."""
|
||||
|
||||
import os
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
from velofy import configuration
|
||||
|
||||
|
||||
revision = "6cb552f31132"
|
||||
down_revision = "81aa304d7a6e"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
config = configuration.make_config("testing" if os.getenv("TESTING") else "production")
|
||||
|
||||
|
||||
def upgrade():
|
||||
"""Upgrade to the next revision."""
|
||||
op.alter_column(
|
||||
"grids",
|
||||
"side_length",
|
||||
existing_type=sa.SmallInteger(),
|
||||
nullable=False,
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
"""Downgrade to the previous revision."""
|
||||
op.alter_column(
|
||||
"grids",
|
||||
"side_length",
|
||||
existing_type=sa.SmallInteger(),
|
||||
nullable=True,
|
||||
schema=config.CLEAN_SCHEMA,
|
||||
)
|
||||
Loading…
Reference in a new issue