From a8a627cd47f7a4e61767b8c9e5f7ee1b9d551406 Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Tue, 3 May 2022 16:21:04 -0700 Subject: [PATCH] Migration to fix error message. (#927) --- ...863186_fix_rs_cant_link_nsf_description.py | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 pay-api/migrations/versions/175c11863186_fix_rs_cant_link_nsf_description.py diff --git a/pay-api/migrations/versions/175c11863186_fix_rs_cant_link_nsf_description.py b/pay-api/migrations/versions/175c11863186_fix_rs_cant_link_nsf_description.py new file mode 100644 index 000000000..316d12144 --- /dev/null +++ b/pay-api/migrations/versions/175c11863186_fix_rs_cant_link_nsf_description.py @@ -0,0 +1,57 @@ +"""fix RS_CANT_LINK_NSF description + +Revision ID: 175c11863186 +Revises: 2ccbd2aad2dc +Create Date: 2022-05-03 16:06:42.663506 + +""" +from alembic import op +from sqlalchemy import String +from sqlalchemy.sql import column, table + + +# revision identifiers, used by Alembic. +revision = '175c11863186' +down_revision = '2ccbd2aad2dc' +branch_labels = None +depends_on = None + + +def upgrade(): + # Delete existing code. + op.execute("DELETE FROM error_codes where code in ('RS_CANT_LINK_NSF')") + error_code_table = table('error_codes', + column('code', String), + column('title', String), + column('detail', String) + ) + + op.bulk_insert( + error_code_table, + [ + { + 'code': 'RS_CANT_LINK_NSF', + 'title': 'Routing Slip cannot be linked.', + 'detail': 'Linking cannot be performed since the Routing slip is NSF.' + } + ]) + + +def downgrade(): + # Delete existing code. + op.execute("DELETE FROM error_codes where code in ('RS_CANT_LINK_NSF')") + error_code_table = table('error_codes', + column('code', String), + column('title', String), + column('detail', String) + ) + + op.bulk_insert( + error_code_table, + [ + { + 'code': 'RS_CANT_LINK_NSF', + 'title': 'Routing Slip cannot be linked.', + 'detail': 'Linking cannot be performed since the routing slip is NSF. It can only be linked to.' + } + ])