Skip to content

Commit

Permalink
WCM-614: Add column for video_type so we can query it in auto areas
Browse files Browse the repository at this point in the history
  • Loading branch information
wosc committed Jan 20, 2025
1 parent 30c8fab commit 98f4464
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""create index for video_type
Revision ID: 239e72a15c2c
Revises: b6c4f9badee3
Create Date: 2025-01-20 11:09:46.675290
"""

from typing import Sequence, Union

from alembic import op


# revision identifiers, used by Alembic.
revision: str = '239e72a15c2c'
down_revision: Union[str, None] = 'b6c4f9badee3'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
with op.get_context().autocommit_block():
op.create_index(
op.f('ix_properties_video_type'),
'properties',
['video_type'],
postgresql_concurrently=True,
if_not_exists=True,
)


def downgrade() -> None:
with op.get_context().autocommit_block():
op.drop_index(
op.f('ix_properties_video_type'),
'properties',
['video_type'],
postgresql_concurrently=True,
if_exists=True,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""add video_type column
Revision ID: f7f17b16292c
Revises: 0d681d9ffda0
Create Date: 2025-01-20 11:06:16.852051
"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'f7f17b16292c'
down_revision: Union[str, None] = '0d681d9ffda0'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.add_column('properties', sa.Column('video_type', sa.Unicode(), nullable=True))


def downgrade() -> None:
op.drop_column('properties', 'video_type')
4 changes: 4 additions & 0 deletions core/src/zeit/connector/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ class ContentTypes:
gallery_type = mapped_column(
Unicode, info={'namespace': 'zeit.content.gallery', 'name': 'type', 'migration': 'wcm_471'}
)
video_type = mapped_column(
Unicode, info={'namespace': 'video', 'name': 'type', 'migration': 'always'}
)


class Timestamps:
Expand Down Expand Up @@ -197,6 +200,7 @@ def __table_args__(cls):
'ressort',
'series',
'sub_ressort',
'video_type',
'volume_number',
'volume_year',
]
Expand Down

0 comments on commit 98f4464

Please sign in to comment.