From 2b4d52a35763d0123e0cd05942267b72fae0fffe Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 15 Aug 2018 11:41:26 -0400 Subject: [PATCH] Migrate the manifest bytes column to UTF8 --- ...1_change_manifest_bytes_to_a_utf8_text_.py | 23 +++++++++++++++++++ ...c7_remove_blob_index_from_manifestblob_.py | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 data/migrations/versions/654e6df88b71_change_manifest_bytes_to_a_utf8_text_.py diff --git a/data/migrations/versions/654e6df88b71_change_manifest_bytes_to_a_utf8_text_.py b/data/migrations/versions/654e6df88b71_change_manifest_bytes_to_a_utf8_text_.py new file mode 100644 index 000000000..cc11d8e4c --- /dev/null +++ b/data/migrations/versions/654e6df88b71_change_manifest_bytes_to_a_utf8_text_.py @@ -0,0 +1,23 @@ +"""Change manifest_bytes to a UTF8 text field + +Revision ID: 654e6df88b71 +Revises: eafdeadcebc7 +Create Date: 2018-08-15 09:58:46.109277 + +""" + +# revision identifiers, used by Alembic. +revision = '654e6df88b71' +down_revision = 'eafdeadcebc7' + +from alembic import op +import sqlalchemy as sa + +from util.migrate import UTF8LongText + + +def upgrade(tables, tester): + op.alter_column('manifest', 'manifest_bytes', existing_type=sa.Text(), type_=UTF8LongText()) + +def downgrade(tables, tester): + op.alter_column('manifest', 'manifest_bytes', existing_type=UTF8LongText(), type_=sa.Text()) diff --git a/data/migrations/versions/eafdeadcebc7_remove_blob_index_from_manifestblob_.py b/data/migrations/versions/eafdeadcebc7_remove_blob_index_from_manifestblob_.py index adf38cefa..011e60261 100644 --- a/data/migrations/versions/eafdeadcebc7_remove_blob_index_from_manifestblob_.py +++ b/data/migrations/versions/eafdeadcebc7_remove_blob_index_from_manifestblob_.py @@ -23,6 +23,6 @@ def upgrade(tables, tester): def downgrade(tables, tester): # ### commands auto generated by Alembic - please adjust! ### - op.add_column('manifestblob', sa.Column('blob_index', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False)) + op.add_column('manifestblob', sa.Column('blob_index', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.create_index('manifestblob_manifest_id_blob_index', 'manifestblob', ['manifest_id', 'blob_index'], unique=True) # ### end Alembic commands ###