diff --git a/octavia/db/migration/alembic_migrations/versions/b8bd389cbae7_update_default_value_in_l7rule_table.py b/octavia/db/migration/alembic_migrations/versions/b8bd389cbae7_update_default_value_in_l7rule_table.py new file mode 100644 index 0000000000..ba5614e42f --- /dev/null +++ b/octavia/db/migration/alembic_migrations/versions/b8bd389cbae7_update_default_value_in_l7rule_table.py @@ -0,0 +1,37 @@ +# Copyright 2020 Yovole +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + +"""update default value in l7rule table + +Revision ID: b8bd389cbae7 +Revises: 8b47b2546312 +Create Date: 2020-12-03 13:40:00.520336 + +""" + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision = 'b8bd389cbae7' +down_revision = 'be9fdc039b51' + + +def upgrade(): + op.alter_column( + 'l7rule', + 'enabled', + existing_nullable=False, + server_default=sa.sql.expression.true()) diff --git a/octavia/db/migration/alembic_migrations/versions/d85ca7258d21_modernize_l7rule.py b/octavia/db/migration/alembic_migrations/versions/d85ca7258d21_modernize_l7rule.py index 3a0f6244bd..11e91ed5ae 100644 --- a/octavia/db/migration/alembic_migrations/versions/d85ca7258d21_modernize_l7rule.py +++ b/octavia/db/migration/alembic_migrations/versions/d85ca7258d21_modernize_l7rule.py @@ -50,7 +50,9 @@ def upgrade(): # Add enabled op.add_column( u'l7rule', - sa.Column(u'enabled', sa.Boolean(), nullable=False) + sa.Column(u'enabled', sa.Boolean(), + server_default=sa.sql.expression.true(), + nullable=False) ) # Add new operating_status column, setting existing rows to ONLINE