Skip to content

Commit

Permalink
If NULL set to 1000
Browse files Browse the repository at this point in the history
  • Loading branch information
dianaclarke committed Jun 15, 2021
1 parent 0b91ba6 commit 703a6a0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions migrations/versions/afc565181834_limit_not_null.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from alembic import op
import sqlalchemy as sa
from sqlalchemy import MetaData


revision = "afc565181834"
Expand All @@ -9,6 +10,17 @@


def upgrade():
connection = op.get_bind()
meta = MetaData()
meta.reflect(bind=connection)
distribution_table = meta.tables["distribution"]

connection.execute(
distribution_table.update()
.where(distribution_table.c.limit == None) # noqa
.values(limit=1000)
)

op.alter_column("distribution", "limit", existing_type=sa.INTEGER(), nullable=False)


Expand Down

0 comments on commit 703a6a0

Please sign in to comment.