18 lines
428 B
Python
18 lines
428 B
Python
|
|
"""Make users.phone nullable."""
|
||
|
|
revision = "0010"
|
||
|
|
down_revision = "0009"
|
||
|
|
branch_labels = None
|
||
|
|
depends_on = None
|
||
|
|
|
||
|
|
from alembic import op
|
||
|
|
import sqlalchemy as sa
|
||
|
|
|
||
|
|
|
||
|
|
def upgrade():
|
||
|
|
op.alter_column("users", "phone", existing_type=sa.String(20), nullable=True)
|
||
|
|
|
||
|
|
|
||
|
|
def downgrade():
|
||
|
|
op.execute("UPDATE users SET phone = '' WHERE phone IS NULL")
|
||
|
|
op.alter_column("users", "phone", existing_type=sa.String(20), nullable=False)
|