From d41362517238b9ea3741c4a565e0b73a12c55b92 Mon Sep 17 00:00:00 2001 From: Abhishek Kekane Date: Fri, 3 Jan 2020 08:15:10 +0000 Subject: [PATCH] Change database migration version to ussuri Change-Id: Ic80b169d34ae9adc6d1329785f80a0d27d2cb241 --- glance/db/migration.py | 4 +-- .../data_migrations/ussuri_migrate01_empty.py | 26 ++++++++++++++++ .../versions/ussuri_contract01_empty.py | 25 ++++++++++++++++ .../versions/ussuri_expand01_empty.py | 30 +++++++++++++++++++ .../db/migrations/test_train_migrate01.py | 2 +- 5 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 glance/db/sqlalchemy/alembic_migrations/data_migrations/ussuri_migrate01_empty.py create mode 100644 glance/db/sqlalchemy/alembic_migrations/versions/ussuri_contract01_empty.py create mode 100644 glance/db/sqlalchemy/alembic_migrations/versions/ussuri_expand01_empty.py diff --git a/glance/db/migration.py b/glance/db/migration.py index b85866b8e0..250fc5863b 100644 --- a/glance/db/migration.py +++ b/glance/db/migration.py @@ -47,9 +47,9 @@ def get_backend(): # Migration-related constants EXPAND_BRANCH = 'expand' CONTRACT_BRANCH = 'contract' -CURRENT_RELEASE = 'train' +CURRENT_RELEASE = 'ussuri' ALEMBIC_INIT_VERSION = 'liberty' -LATEST_REVISION = 'rocky_contract02' +LATEST_REVISION = 'train_contract01' INIT_VERSION = 0 MIGRATE_REPO_PATH = os.path.join( diff --git a/glance/db/sqlalchemy/alembic_migrations/data_migrations/ussuri_migrate01_empty.py b/glance/db/sqlalchemy/alembic_migrations/data_migrations/ussuri_migrate01_empty.py new file mode 100644 index 0000000000..acc20d6cf9 --- /dev/null +++ b/glance/db/sqlalchemy/alembic_migrations/data_migrations/ussuri_migrate01_empty.py @@ -0,0 +1,26 @@ +# Copyright (C) 2020 RedHat Inc. +# All Rights Reserved. +# +# 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. + + +def has_migrations(engine): + """Returns true if at least one data row can be migrated.""" + + return False + + +def migrate(engine): + """Return the number of rows migrated.""" + + return 0 diff --git a/glance/db/sqlalchemy/alembic_migrations/versions/ussuri_contract01_empty.py b/glance/db/sqlalchemy/alembic_migrations/versions/ussuri_contract01_empty.py new file mode 100644 index 0000000000..5a23b66d8a --- /dev/null +++ b/glance/db/sqlalchemy/alembic_migrations/versions/ussuri_contract01_empty.py @@ -0,0 +1,25 @@ +# Copyright (C) 2020 RedHat Inc +# All Rights Reserved. +# +# 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. + + +# revision identifiers, used by Alembic. +revision = 'ussuri_contract01' +down_revision = 'train_contract01' +branch_labels = None +depends_on = 'ussuri_expand01' + + +def upgrade(): + pass diff --git a/glance/db/sqlalchemy/alembic_migrations/versions/ussuri_expand01_empty.py b/glance/db/sqlalchemy/alembic_migrations/versions/ussuri_expand01_empty.py new file mode 100644 index 0000000000..2993b1c8cb --- /dev/null +++ b/glance/db/sqlalchemy/alembic_migrations/versions/ussuri_expand01_empty.py @@ -0,0 +1,30 @@ +# Copyright (C) 2020 RedHat Inc +# 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. + +"""empty expand for symmetry with ussuri_expand01 + +Revision ID: ussuri_expand01 +Revises: train_expand01 +Create Date: 2020-01-03 11:55:16.657499 + +""" + +# revision identifiers, used by Alembic. +revision = 'ussuri_expand01' +down_revision = 'train_expand01' +branch_labels = None +depends_on = None + + +def upgrade(): + pass diff --git a/glance/tests/functional/db/migrations/test_train_migrate01.py b/glance/tests/functional/db/migrations/test_train_migrate01.py index 8cfbf55128..1c4dab60cc 100644 --- a/glance/tests/functional/db/migrations/test_train_migrate01.py +++ b/glance/tests/functional/db/migrations/test_train_migrate01.py @@ -81,7 +81,7 @@ class TestTrainMigrate01Mixin(test_migrations.AlembicMigrationsMixin): self.assertIn('"backend":', row['meta_data']) # run data migrations - data_migrations.migrate(engine) + data_migrations.migrate(engine, release='train') # check that meta_data has 'backend' key replaced with 'store' rows = (image_locations.select()