Skip to content

Commit

Permalink
Add migration for person headline size increase
Browse files Browse the repository at this point in the history
  • Loading branch information
shrir committed Nov 27, 2024
1 parent 95fd7f1 commit 73136d0
Showing 1 changed file with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# type: ignore
"""Increase person headline size
Revision ID: 61c09de3ee8d
Revises: b3fa17a12cca
Create Date: 2024-11-27 17:08:46.271597+00:00
"""
from __future__ import annotations

import warnings
from typing import TYPE_CHECKING

import sqlalchemy as sa
from alembic import op
from advanced_alchemy.types import EncryptedString, EncryptedText, GUID, ORA_JSONB, DateTimeUTC
from sqlalchemy import Text # noqa: F401

if TYPE_CHECKING:
from collections.abc import Sequence

__all__ = ["downgrade", "upgrade", "schema_upgrades", "schema_downgrades", "data_upgrades", "data_downgrades"]

sa.GUID = GUID
sa.DateTimeUTC = DateTimeUTC
sa.ORA_JSONB = ORA_JSONB
sa.EncryptedString = EncryptedString
sa.EncryptedText = EncryptedText

# revision identifiers, used by Alembic.
revision = "61c09de3ee8d"
down_revision = "b3fa17a12cca"
branch_labels = None
depends_on = None


def upgrade() -> None:
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=UserWarning)
with op.get_context().autocommit_block():
schema_upgrades()
data_upgrades()


def downgrade() -> None:
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=UserWarning)
with op.get_context().autocommit_block():
data_downgrades()
schema_downgrades()


def schema_upgrades() -> None:
"""schema upgrade migrations go here."""
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("person", schema=None) as batch_op:
batch_op.alter_column(
"headline", existing_type=sa.String(length=500), type_=sa.String(length=2000), existing_nullable=True
)

# ### end Alembic commands ###


def schema_downgrades() -> None:
"""schema downgrade migrations go here."""
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("person", schema=None) as batch_op:
batch_op.alter_column(
"headline", existing_type=sa.String(length=2000), type_=sa.String(length=500), existing_nullable=True
)

# ### end Alembic commands ###


def data_upgrades() -> None:
"""Add any optional data upgrade migrations here!"""


def data_downgrades() -> None:
"""Add any optional data downgrade migrations here!"""

0 comments on commit 73136d0

Please sign in to comment.