# HG changeset patch # User Goffi # Date 1746483583 -7200 # Node ID fa300abc3cb62c37cfe9facd180d22f0fb7c6bf1 # Parent 4da560a8aed323af2713da8f255f62401ec7f380 storage: Add missing migration script to use JSON type instead of TEXT in History and private binary data. diff -r 4da560a8aed3 -r fa300abc3cb6 libervia/backend/memory/migration/versions/29f85e56b6d4_use_json_type_in_history_and_for_.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libervia/backend/memory/migration/versions/29f85e56b6d4_use_json_type_in_history_and_for_.py Tue May 06 00:19:43 2025 +0200 @@ -0,0 +1,56 @@ +"""use JSON type in History and for private bin values + +Revision ID: 29f85e56b6d4 +Revises: fe3a02cb4bec +Create Date: 2025-05-02 11:20:11.555189 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '29f85e56b6d4' +down_revision = 'fe3a02cb4bec' +branch_labels = None +depends_on = None + + +def upgrade(): + with op.batch_alter_table('history', schema=None) as batch_op: + batch_op.alter_column('extra', + existing_type=sa.TEXT(), + type_=sa.JSON(), + existing_nullable=True) + + with op.batch_alter_table('private_gen_bin', schema=None) as batch_op: + batch_op.alter_column('value', + existing_type=sa.TEXT(), + type_=sa.JSON(), + existing_nullable=True) + + with op.batch_alter_table('private_ind_bin', schema=None) as batch_op: + batch_op.alter_column('value', + existing_type=sa.TEXT(), + type_=sa.JSON(), + existing_nullable=True) + + +def downgrade(): + with op.batch_alter_table('private_ind_bin', schema=None) as batch_op: + batch_op.alter_column('value', + existing_type=sa.JSON(), + type_=sa.TEXT(), + existing_nullable=True) + + with op.batch_alter_table('private_gen_bin', schema=None) as batch_op: + batch_op.alter_column('value', + existing_type=sa.JSON(), + type_=sa.TEXT(), + existing_nullable=True) + + with op.batch_alter_table('history', schema=None) as batch_op: + batch_op.alter_column('extra', + existing_type=sa.JSON(), + type_=sa.TEXT(), + existing_nullable=True)