From 6779e19ac91830139448511b60a91047f40088ba Mon Sep 17 00:00:00 2001 From: kevgliss Date: Thu, 13 Jul 2017 13:12:53 -0700 Subject: [PATCH] Adding enum migration. (#852) --- lemur/migrations/versions/1ae8e3104db8_.py | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lemur/migrations/versions/1ae8e3104db8_.py diff --git a/lemur/migrations/versions/1ae8e3104db8_.py b/lemur/migrations/versions/1ae8e3104db8_.py new file mode 100644 index 00000000..2189ed0d --- /dev/null +++ b/lemur/migrations/versions/1ae8e3104db8_.py @@ -0,0 +1,41 @@ +"""Adds additional ENUM for creating and updating certificates. + +Revision ID: 1ae8e3104db8 +Revises: a02a678ddc25 +Create Date: 2017-07-13 12:32:09.162800 + +""" + +# revision identifiers, used by Alembic. +revision = '1ae8e3104db8' +down_revision = 'a02a678ddc25' + +from alembic import op + + +def upgrade(): + connection = None + + if not op.get_context().as_sql: + connection = op.get_bind() + connection.execution_options(isolation_level='AUTOCOMMIT') + + op.execute("ALTER TYPE log_type ADD VALUE 'create_cert'") + op.execute("ALTER TYPE log_type ADD VALUE 'update_cert'") + + if connection is not None: + connection.execution_options(isolation_level='READ_COMMITTED') + + +def downgrade(): + connection = None + + if not op.get_context().as_sql: + connection = op.get_bind() + connection.execution_options(isolation_level='AUTOCOMMIT') + + op.execute("ALTER TYPE log_type DROP VALUE 'create_cert'") + op.execute("ALTER TYPE log_type DROP VALUE 'update_cert'") + + if connection is not None: + connection.execution_options(isolation_level='READ_COMMITTED')