Merge "Update migration constant"
This commit is contained in:
@@ -29,5 +29,5 @@ db_options.set_defaults(cfg.CONF)
|
||||
# Migration-related constants
|
||||
EXPAND_BRANCH = 'expand'
|
||||
CONTRACT_BRANCH = 'contract'
|
||||
CURRENT_RELEASE = 'zed'
|
||||
CURRENT_RELEASE = '2023_1'
|
||||
ALEMBIC_INIT_VERSION = 'liberty'
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Copyright (C) 2021 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
|
||||
@@ -0,0 +1,26 @@
|
||||
# Copyright (C) 2021 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
|
||||
@@ -0,0 +1,26 @@
|
||||
# Copyright (C) 2021 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
|
||||
@@ -0,0 +1,26 @@
|
||||
# Copyright (C) 2021 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
|
||||
@@ -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 = '2023_1_contract01'
|
||||
down_revision = 'zed_contract01'
|
||||
branch_labels = None
|
||||
depends_on = '2023_1_expand01'
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
@@ -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 2023_1_expand01
|
||||
|
||||
Revision ID: ussuri_expand01
|
||||
Revises: train_expand01
|
||||
Create Date: 2020-01-03 11:55:16.657499
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2023_1_expand01'
|
||||
down_revision = 'zed_expand01'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
@@ -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 = 'xena_contract01'
|
||||
down_revision = 'wallaby_contract01'
|
||||
branch_labels = None
|
||||
depends_on = 'xena_expand01'
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
@@ -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 2023_1_expand01
|
||||
|
||||
Revision ID: ussuri_expand01
|
||||
Revises: train_expand01
|
||||
Create Date: 2020-01-03 11:55:16.657499
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'xena_expand01'
|
||||
down_revision = 'wallaby_expand01'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
@@ -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 = 'yoga_contract01'
|
||||
down_revision = 'xena_contract01'
|
||||
branch_labels = None
|
||||
depends_on = 'yoga_expand01'
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
@@ -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 2023_1_expand01
|
||||
|
||||
Revision ID: ussuri_expand01
|
||||
Revises: train_expand01
|
||||
Create Date: 2020-01-03 11:55:16.657499
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'yoga_expand01'
|
||||
down_revision = 'xena_expand01'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
@@ -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 = 'zed_contract01'
|
||||
down_revision = 'yoga_contract01'
|
||||
branch_labels = None
|
||||
depends_on = 'zed_expand01'
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
@@ -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 2023_1_expand01
|
||||
|
||||
Revision ID: ussuri_expand01
|
||||
Revises: train_expand01
|
||||
Create Date: 2020-01-03 11:55:16.657499
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'zed_expand01'
|
||||
down_revision = 'yoga_expand01'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
@@ -63,21 +63,44 @@ class TestVersions(test_utils.BaseTestCase):
|
||||
for prefix in exception_releases]):
|
||||
continue
|
||||
|
||||
# File format should be release_phaseNN_description.py
|
||||
try:
|
||||
_rest = '' # noqa
|
||||
release, phasever, _rest = version_file.split('_', 2)
|
||||
except ValueError:
|
||||
release = phasever = ''
|
||||
phase = ''.join(x for x in phasever if x.isalpha())
|
||||
# Grab the non-numeric part of phaseNN
|
||||
if phase not in required_phases:
|
||||
# Help make sure that going forward developers stick to the
|
||||
# consistent format.
|
||||
self.fail('Migration files should be in the form of: '
|
||||
'release_phaseNN_some_description.py '
|
||||
'(while processing %r)' % version_file)
|
||||
releases[release].add(phase)
|
||||
# For legacy database scripts does not starts with
|
||||
# YYYY i.e. pre Antelope
|
||||
if not version_file.split('_', 2)[0].isnumeric():
|
||||
# File format should be release_phaseNN_description.py
|
||||
try:
|
||||
_rest = '' # noqa
|
||||
release, phasever, _rest = version_file.split('_', 2)
|
||||
except ValueError:
|
||||
release = phasever = ''
|
||||
phase = ''.join(x for x in phasever if x.isalpha())
|
||||
# Grab the non-numeric part of phaseNN
|
||||
if phase not in required_phases:
|
||||
# Help make sure that going forward developers stick to the
|
||||
# consistent format.
|
||||
self.fail('Migration files should be in the form of: '
|
||||
'release_phaseNN_some_description.py '
|
||||
'(while processing %r)' % version_file)
|
||||
releases[release].add(phase)
|
||||
else:
|
||||
# For new database scripts i.e. Antelope onwards
|
||||
# File format should be
|
||||
# releaseYear_releaseN_phaseNN_description.py
|
||||
# For example 2023_1_expand01_empty.py
|
||||
try:
|
||||
_rest = '' # noqa
|
||||
release_y, release_n, phasever, _rest = version_file.split(
|
||||
'_', 3)
|
||||
except ValueError:
|
||||
release_y = phasever = ''
|
||||
phase = ''.join(x for x in phasever if x.isalpha())
|
||||
# Grab the non-numeric part of phaseNN
|
||||
if phase not in required_phases:
|
||||
# Help make sure that going forward developers stick to the
|
||||
# consistent format.
|
||||
self.fail('Migration files should be in the form of: '
|
||||
'releaseYear_releaseN_phaseNN_description.py '
|
||||
'(while processing %r)' % version_file)
|
||||
releases[release_y].add(phase)
|
||||
|
||||
for release, phases in releases.items():
|
||||
missing = required_phases - phases
|
||||
|
||||
Reference in New Issue
Block a user