Skip to content

Commit

Permalink
Merge pull request #50 from climatepolicyradar/feature/pdct-1245-copy…
Browse files Browse the repository at this point in the history
…-document-role-into-family-doc-metadata-column-object

Feature/pdct 1245 make family document metadata column not nullable
  • Loading branch information
katybaulch authored Jul 9, 2024
2 parents 80d83d7 + 21b7b12 commit b71088e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"""

import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql

revision = "0045"
down_revision = "0044"
Expand All @@ -27,6 +29,12 @@ def upgrade():
WHERE family_document.import_id = subquery.import_id
AND family_document.valid_metadata IS NULL"""
)
op.alter_column(
"family_document",
"valid_metadata",
existing_type=postgresql.JSONB(astext_type=sa.Text()),
nullable=False,
)


def downgrade():
Expand Down
2 changes: 1 addition & 1 deletion db_client/models/dfce/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class FamilyDocument(Base):
lazy="joined",
)

valid_metadata = sa.Column(postgresql.JSONB)
valid_metadata = sa.Column(postgresql.JSONB, nullable=False)


class Slug(Base):
Expand Down

0 comments on commit b71088e

Please sign in to comment.