Skip to content

Commit

Permalink
fix: alembic recipe column not altered
Browse files Browse the repository at this point in the history
* produces error on the ext.alembic.compare_metadata() test on other
  packages
  • Loading branch information
utnapischtim committed Dec 10, 2024
1 parent ae121bc commit c8325de
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2024 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

"""Alter column from json to jsonb."""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "428b919be0ea"
down_revision = "07fb52561c5c"
branch_labels = ()
depends_on = None


def upgrade():
"""Upgrade database."""
if op._proxy.migration_context.dialect.name == "postgresql":
op.alter_column(
"records_metadata_version",
"json",
type_=sa.dialects.postgresql.JSONB,
postgresql_using="json::text::jsonb",
)


def downgrade():
"""Downgrade database."""
if op._proxy.migration_context.dialect.name == "postgresql":
op.alter_column(
"records_metadata_version",
"json",
type_=sa.dialects.postgresql.JSON,
postgresql_using="json::text::json",
)

0 comments on commit c8325de

Please sign in to comment.