From b612f24b6656280a75a43ee39bf4fb83e2a434cc Mon Sep 17 00:00:00 2001 From: EdLeafe Date: Mon, 15 Oct 2018 19:52:24 +0000 Subject: [PATCH] Delete the old migrations As the first step to implementing alembic for our data migrations, we need to get rid of the old migration files. Change-Id: Ib6ee4895a3c5b18b027f1ac44905dff0e28cdcf8 --- .../db/sqlalchemy/api_migrations/__init__.py | 0 .../api_migrations/migrate_repo/README | 4 - .../api_migrations/migrate_repo/__init__.py | 0 .../api_migrations/migrate_repo/migrate.cfg | 20 --- .../migrate_repo/versions/001_cell_mapping.py | 42 ------ .../versions/002_instance_mapping.py | 46 ------- .../migrate_repo/versions/003_host_mapping.py | 44 ------- .../versions/004_add_request_spec.py | 41 ------ .../migrate_repo/versions/005_flavors.py | 82 ------------ .../versions/006_build_request.py | 68 ---------- .../007_instance_mapping_nullable_cellid.py | 22 ---- .../migrate_repo/versions/008_placeholder.py | 23 ---- .../migrate_repo/versions/009_placeholder.py | 23 ---- .../migrate_repo/versions/010_placeholder.py | 23 ---- .../migrate_repo/versions/011_placeholder.py | 23 ---- .../migrate_repo/versions/012_placeholder.py | 23 ---- .../013_build_request_extended_attrs.py | 52 -------- .../migrate_repo/versions/014_keypairs.py | 15 --- .../015_build_request_nullable_columns.py | 48 ------- .../versions/016_resource_providers.py | 110 ---------------- .../migrate_repo/versions/017_aggregates.py | 73 ----------- .../versions/018_instance_groups.py | 71 ---------- ..._build_request_add_block_device_mapping.py | 26 ---- .../020_block_device_mappings_mediumtext.py | 24 ---- .../migrate_repo/versions/021_placeholder.py | 23 ---- .../migrate_repo/versions/022_placeholder.py | 23 ---- .../migrate_repo/versions/023_placeholder.py | 23 ---- .../migrate_repo/versions/024_placeholder.py | 23 ---- .../migrate_repo/versions/025_placeholder.py | 23 ---- .../versions/026_add_resource_classes.py | 36 ----- .../migrate_repo/versions/027_quotas.py | 124 ------------------ .../028_build_requests_instance_mediumtext.py | 24 ---- .../migrate_repo/versions/029_aggregates.py | 37 ------ .../versions/030_require_cell_setup.py | 59 --------- .../migrate_repo/versions/031_placeholder.py | 23 ---- .../migrate_repo/versions/032_placeholder.py | 23 ---- .../migrate_repo/versions/033_placeholder.py | 23 ---- .../migrate_repo/versions/034_placeholder.py | 23 ---- .../migrate_repo/versions/035_placeholder.py | 23 ---- .../migrate_repo/versions/036_placeholder.py | 23 ---- .../migrate_repo/versions/037_placeholder.py | 23 ---- .../migrate_repo/versions/038_placeholder.py | 23 ---- .../migrate_repo/versions/039_placeholder.py | 23 ---- .../migrate_repo/versions/040_placeholder.py | 23 ---- .../versions/041_resource_provider_traits.py | 66 ---------- .../versions/042_build_requests_add_tags.py | 26 ---- .../migrate_repo/versions/043_consumers.py | 44 ------- .../versions/044_add_projects_users.py | 72 ---------- .../migrate_repo/versions/045_placeholder.py | 23 ---- .../migrate_repo/versions/046_placeholder.py | 23 ---- .../migrate_repo/versions/047_placeholder.py | 23 ---- .../migrate_repo/versions/048_placeholder.py | 23 ---- .../migrate_repo/versions/049_placeholder.py | 23 ---- .../versions/050_flavors_add_description.py | 26 ---- .../versions/051_nested_resource_providers.py | 50 ------- .../052_request_specs_spec_mediumtext.py | 25 ---- .../migrate_repo/versions/053_placeholder.py | 22 ---- .../migrate_repo/versions/054_placeholder.py | 22 ---- .../migrate_repo/versions/055_placeholder.py | 22 ---- .../migrate_repo/versions/056_placeholder.py | 22 ---- .../migrate_repo/versions/057_placeholder.py | 22 ---- .../versions/058_cell_mapping_add_disabled.py | 26 ---- .../versions/059_add_consumer_generation.py | 29 ---- .../060_instance_group_policy_add_rules.py | 26 ---- ..._instance_mapping_add_queued_for_delete.py | 27 ---- .../migrate_repo/versions/__init__.py | 0 66 files changed, 2170 deletions(-) delete mode 100644 placement/db/sqlalchemy/api_migrations/__init__.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/README delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/__init__.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/migrate.cfg delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/001_cell_mapping.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/002_instance_mapping.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/003_host_mapping.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/004_add_request_spec.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/005_flavors.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/006_build_request.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/007_instance_mapping_nullable_cellid.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/008_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/009_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/010_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/011_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/012_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/013_build_request_extended_attrs.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/014_keypairs.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/015_build_request_nullable_columns.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/016_resource_providers.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/017_aggregates.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/018_instance_groups.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/019_build_request_add_block_device_mapping.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/020_block_device_mappings_mediumtext.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/021_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/022_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/023_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/024_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/025_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/026_add_resource_classes.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/027_quotas.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/028_build_requests_instance_mediumtext.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/029_aggregates.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/030_require_cell_setup.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/031_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/032_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/033_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/034_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/035_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/036_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/037_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/038_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/039_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/040_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/041_resource_provider_traits.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/042_build_requests_add_tags.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/043_consumers.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/044_add_projects_users.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/045_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/046_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/047_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/048_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/049_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/050_flavors_add_description.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/051_nested_resource_providers.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/052_request_specs_spec_mediumtext.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/053_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/054_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/055_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/056_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/057_placeholder.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/058_cell_mapping_add_disabled.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/059_add_consumer_generation.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/060_instance_group_policy_add_rules.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/061_instance_mapping_add_queued_for_delete.py delete mode 100644 placement/db/sqlalchemy/api_migrations/migrate_repo/versions/__init__.py diff --git a/placement/db/sqlalchemy/api_migrations/__init__.py b/placement/db/sqlalchemy/api_migrations/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/README b/placement/db/sqlalchemy/api_migrations/migrate_repo/README deleted file mode 100644 index 6218f8cac..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/README +++ /dev/null @@ -1,4 +0,0 @@ -This is a database migration repository. - -More information at -http://code.google.com/p/sqlalchemy-migrate/ diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/__init__.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/migrate.cfg b/placement/db/sqlalchemy/api_migrations/migrate_repo/migrate.cfg deleted file mode 100644 index fe72139f5..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/migrate.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[db_settings] -# Used to identify which repository this database is versioned under. -# You can use the name of your project. -repository_id=placement - -# The name of the database table used to track the schema version. -# This name shouldn't already be used by your project. -# If this is changed once a database is under version control, you'll need to -# change the table name in each database too. -version_table=migrate_version - -# When committing a change script, Migrate will attempt to generate the -# sql for all supported databases; normally, if one of them fails - probably -# because you don't have that database installed - it is ignored and the -# commit continues, perhaps ending successfully. -# Databases in this list MUST compile successfully during a commit, or the -# entire commit will fail. List the databases your application will actually -# be using to ensure your updates to that database work properly. -# This must be a list; example: ['postgres','sqlite'] -required_dbs=[] diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/001_cell_mapping.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/001_cell_mapping.py deleted file mode 100644 index 7a2ed37c9..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/001_cell_mapping.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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. - -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table -from sqlalchemy import Text - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - cell_mappings = Table('cell_mappings', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('uuid', String(length=36), nullable=False), - Column('name', String(length=255)), - Column('transport_url', Text()), - Column('database_connection', Text()), - UniqueConstraint('uuid', name='uniq_cell_mappings0uuid'), - Index('uuid_idx', 'uuid'), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - cell_mappings.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/002_instance_mapping.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/002_instance_mapping.py deleted file mode 100644 index 5226b1609..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/002_instance_mapping.py +++ /dev/null @@ -1,46 +0,0 @@ -# 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. - -from migrate.changeset.constraint import ForeignKeyConstraint -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - cell_mappings = Table('cell_mappings', meta, autoload=True) - instance_mappings = Table('instance_mappings', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('instance_uuid', String(length=36), nullable=False), - Column('cell_id', Integer, nullable=False), - Column('project_id', String(length=255), nullable=False), - UniqueConstraint('instance_uuid', - name='uniq_instance_mappings0instance_uuid'), - Index('instance_uuid_idx', 'instance_uuid'), - Index('project_id_idx', 'project_id'), - ForeignKeyConstraint(columns=['cell_id'], - refcolumns=[cell_mappings.c.id]), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - instance_mappings.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/003_host_mapping.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/003_host_mapping.py deleted file mode 100644 index 089126319..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/003_host_mapping.py +++ /dev/null @@ -1,44 +0,0 @@ -# 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. - -from migrate.changeset.constraint import ForeignKeyConstraint -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - cell_mappings = Table('cell_mappings', meta, autoload=True) - host_mappings = Table('host_mappings', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('cell_id', Integer, nullable=False), - Column('host', String(length=255), nullable=False), - UniqueConstraint('host', - name='uniq_host_mappings0host'), - Index('host_idx', 'host'), - ForeignKeyConstraint(columns=['cell_id'], - refcolumns=[cell_mappings.c.id]), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - host_mappings.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/004_add_request_spec.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/004_add_request_spec.py deleted file mode 100644 index 465f3e1f8..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/004_add_request_spec.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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. - -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table -from sqlalchemy import Text - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - request_specs = Table('request_specs', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('instance_uuid', String(36), nullable=False), - Column('spec', Text, nullable=False), - UniqueConstraint('instance_uuid', - name='uniq_request_specs0instance_uuid'), - Index('request_spec_instance_uuid_idx', 'instance_uuid'), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - request_specs.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/005_flavors.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/005_flavors.py deleted file mode 100644 index 95e269c7d..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/005_flavors.py +++ /dev/null @@ -1,82 +0,0 @@ -# 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. - -from migrate.changeset.constraint import ForeignKeyConstraint -from migrate import UniqueConstraint -from sqlalchemy import Boolean -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import Float -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - flavors = Table('flavors', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('name', String(length=255), nullable=False), - Column('id', Integer, primary_key=True, nullable=False), - Column('memory_mb', Integer, nullable=False), - Column('vcpus', Integer, nullable=False), - Column('swap', Integer, nullable=False), - Column('vcpu_weight', Integer), - Column('flavorid', String(length=255), nullable=False), - Column('rxtx_factor', Float), - Column('root_gb', Integer), - Column('ephemeral_gb', Integer), - Column('disabled', Boolean), - Column('is_public', Boolean), - UniqueConstraint("flavorid", name="uniq_flavors0flavorid"), - UniqueConstraint("name", name="uniq_flavors0name"), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - flavors.create(checkfirst=True) - - flavor_extra_specs = Table('flavor_extra_specs', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('flavor_id', Integer, nullable=False), - Column('key', String(length=255), nullable=False), - Column('value', String(length=255)), - UniqueConstraint('flavor_id', 'key', - name='uniq_flavor_extra_specs0flavor_id0key'), - Index('flavor_extra_specs_flavor_id_key_idx', 'flavor_id', 'key'), - ForeignKeyConstraint(columns=['flavor_id'], refcolumns=[flavors.c.id]), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - flavor_extra_specs.create(checkfirst=True) - - flavor_projects = Table('flavor_projects', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('flavor_id', Integer, nullable=False), - Column('project_id', String(length=255), nullable=False), - UniqueConstraint('flavor_id', 'project_id', - name='uniq_flavor_projects0flavor_id0project_id'), - ForeignKeyConstraint(columns=['flavor_id'], - refcolumns=[flavors.c.id]), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - flavor_projects.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/006_build_request.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/006_build_request.py deleted file mode 100644 index 6505c6255..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/006_build_request.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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. - -from migrate.changeset.constraint import ForeignKeyConstraint -from migrate import UniqueConstraint -from sqlalchemy import Boolean -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import dialects -from sqlalchemy import Enum -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table -from sqlalchemy import Text - - -def InetSmall(): - return String(length=39).with_variant(dialects.postgresql.INET(), - 'postgresql') - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - request_specs = Table('request_specs', meta, autoload=True) - build_requests = Table('build_requests', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('request_spec_id', Integer, nullable=False), - Column('project_id', String(length=255), nullable=False), - Column('user_id', String(length=255), nullable=False), - Column('display_name', String(length=255)), - Column('instance_metadata', Text), - Column('progress', Integer), - Column('vm_state', String(length=255)), - Column('task_state', String(length=255)), - Column('image_ref', String(length=255)), - Column('access_ip_v4', InetSmall()), - Column('access_ip_v6', InetSmall()), - Column('info_cache', Text), - Column('security_groups', Text, nullable=False), - Column('config_drive', Boolean, default=False, nullable=False), - Column('key_name', String(length=255)), - Column('locked_by', Enum('owner', 'admin', - name='build_requests0locked_by')), - UniqueConstraint('request_spec_id', - name='uniq_build_requests0request_spec_id'), - Index('build_requests_project_id_idx', 'project_id'), - ForeignKeyConstraint(columns=['request_spec_id'], - refcolumns=[request_specs.c.id]), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - build_requests.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/007_instance_mapping_nullable_cellid.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/007_instance_mapping_nullable_cellid.py deleted file mode 100644 index a23bb75d0..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/007_instance_mapping_nullable_cellid.py +++ /dev/null @@ -1,22 +0,0 @@ -# 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. - -from sqlalchemy import MetaData -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - instance_mapping = Table('instance_mappings', meta, autoload=True) - instance_mapping.c.cell_id.alter(nullable=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/008_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/008_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/008_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/009_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/009_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/009_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/010_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/010_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/010_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/011_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/011_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/011_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/012_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/012_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/012_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/013_build_request_extended_attrs.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/013_build_request_extended_attrs.py deleted file mode 100644 index 50b20e8d4..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/013_build_request_extended_attrs.py +++ /dev/null @@ -1,52 +0,0 @@ -# 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. - -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy.engine import reflection -from sqlalchemy import Index -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table -from sqlalchemy import Text - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - build_requests = Table('build_requests', meta, autoload=True) - - columns_to_add = [ - ('instance_uuid', - Column('instance_uuid', String(length=36))), - ('instance', - Column('instance', Text())), - ] - for (col_name, column) in columns_to_add: - if not hasattr(build_requests.c, col_name): - build_requests.create_column(column) - - for index in build_requests.indexes: - if [c.name for c in index.columns] == ['instance_uuid']: - break - else: - index = Index('build_requests_instance_uuid_idx', - build_requests.c.instance_uuid) - index.create() - - inspector = reflection.Inspector.from_engine(migrate_engine) - constrs = inspector.get_unique_constraints('build_requests') - constr_names = [constr['name'] for constr in constrs] - if 'uniq_build_requests0instance_uuid' not in constr_names: - UniqueConstraint('instance_uuid', table=build_requests, - name='uniq_build_requests0instance_uuid').create() diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/014_keypairs.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/014_keypairs.py deleted file mode 100644 index 8aa15c1ef..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/014_keypairs.py +++ /dev/null @@ -1,15 +0,0 @@ -# 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 upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/015_build_request_nullable_columns.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/015_build_request_nullable_columns.py deleted file mode 100644 index 36304eb23..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/015_build_request_nullable_columns.py +++ /dev/null @@ -1,48 +0,0 @@ -# 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. - -from migrate.changeset.constraint import ForeignKeyConstraint -from migrate import UniqueConstraint -from sqlalchemy.engine import reflection -from sqlalchemy import MetaData -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - build_requests = Table('build_requests', meta, autoload=True) - request_specs = Table('request_specs', meta, autoload=True) - - for fkey in build_requests.foreign_keys: - if fkey.target_fullname == 'request_specs.id': - ForeignKeyConstraint(columns=['request_spec_id'], - refcolumns=[request_specs.c.id], - table=build_requests, - name=fkey.name).drop() - break - - # These are being made nullable because they are no longer used after the - # addition of the instance column. However they need a deprecation period - # before they can be dropped. - columns_to_nullify = ['request_spec_id', 'user_id', 'security_groups', - 'config_drive'] - for column in columns_to_nullify: - getattr(build_requests.c, column).alter(nullable=True) - - inspector = reflection.Inspector.from_engine(migrate_engine) - constrs = inspector.get_unique_constraints('build_requests') - constr_names = [constr['name'] for constr in constrs] - if 'uniq_build_requests0request_spec_id' in constr_names: - UniqueConstraint('request_spec_id', table=build_requests, - name='uniq_build_requests0request_spec_id').drop() diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/016_resource_providers.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/016_resource_providers.py deleted file mode 100644 index 48502d2ce..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/016_resource_providers.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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. -"""Database migrations for resource-providers.""" - -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import Float -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table -from sqlalchemy import Unicode - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - if migrate_engine.name == 'mysql': - nameargs = {'collation': 'utf8_bin'} - else: - nameargs = {} - resource_providers = Table( - 'resource_providers', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('uuid', String(36), nullable=False), - Column('name', Unicode(200, **nameargs), nullable=True), - Column('generation', Integer, default=0), - Column('can_host', Integer, default=0), - UniqueConstraint('uuid', name='uniq_resource_providers0uuid'), - UniqueConstraint('name', name='uniq_resource_providers0name'), - Index('resource_providers_name_idx', 'name'), - Index('resource_providers_uuid_idx', 'uuid'), - mysql_engine='InnoDB', - mysql_charset='latin1' - ) - - inventories = Table( - 'inventories', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('resource_provider_id', Integer, nullable=False), - Column('resource_class_id', Integer, nullable=False), - Column('total', Integer, nullable=False), - Column('reserved', Integer, nullable=False), - Column('min_unit', Integer, nullable=False), - Column('max_unit', Integer, nullable=False), - Column('step_size', Integer, nullable=False), - Column('allocation_ratio', Float, nullable=False), - Index('inventories_resource_provider_id_idx', - 'resource_provider_id'), - Index('inventories_resource_provider_resource_class_idx', - 'resource_provider_id', 'resource_class_id'), - Index('inventories_resource_class_id_idx', - 'resource_class_id'), - UniqueConstraint('resource_provider_id', 'resource_class_id', - name='uniq_inventories0resource_provider_resource_class'), - mysql_engine='InnoDB', - mysql_charset='latin1' - ) - - allocations = Table( - 'allocations', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('resource_provider_id', Integer, nullable=False), - Column('consumer_id', String(36), nullable=False), - Column('resource_class_id', Integer, nullable=False), - Column('used', Integer, nullable=False), - Index('allocations_resource_provider_class_used_idx', - 'resource_provider_id', 'resource_class_id', - 'used'), - Index('allocations_resource_class_id_idx', - 'resource_class_id'), - Index('allocations_consumer_id_idx', 'consumer_id'), - mysql_engine='InnoDB', - mysql_charset='latin1' - ) - - resource_provider_aggregates = Table( - 'resource_provider_aggregates', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('resource_provider_id', Integer, primary_key=True, - nullable=False), - Column('aggregate_id', Integer, primary_key=True, nullable=False), - Index('resource_provider_aggregates_aggregate_id_idx', - 'aggregate_id'), - mysql_engine='InnoDB', - mysql_charset='latin1' - ) - - for table in [resource_providers, inventories, allocations, - resource_provider_aggregates]: - table.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/017_aggregates.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/017_aggregates.py deleted file mode 100644 index 482a6aa9d..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/017_aggregates.py +++ /dev/null @@ -1,73 +0,0 @@ -# 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. -"""API Database migrations for aggregates""" - -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import ForeignKey -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - aggregates = Table('aggregates', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('uuid', String(length=36)), - Column('name', String(length=255)), - Index('aggregate_uuid_idx', 'uuid'), - UniqueConstraint('name', name='uniq_aggregate0name'), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - aggregates.create(checkfirst=True) - - aggregate_hosts = Table('aggregate_hosts', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('host', String(length=255)), - Column('aggregate_id', Integer, ForeignKey('aggregates.id'), - nullable=False), - UniqueConstraint('host', 'aggregate_id', - name='uniq_aggregate_hosts0host0aggregate_id'), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - aggregate_hosts.create(checkfirst=True) - - aggregate_metadata = Table('aggregate_metadata', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('aggregate_id', Integer, ForeignKey('aggregates.id'), - nullable=False), - Column('key', String(length=255), nullable=False), - Column('value', String(length=255), nullable=False), - UniqueConstraint('aggregate_id', 'key', - name='uniq_aggregate_metadata0aggregate_id0key'), - Index('aggregate_metadata_key_idx', 'key'), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - aggregate_metadata.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/018_instance_groups.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/018_instance_groups.py deleted file mode 100644 index 08d952fb1..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/018_instance_groups.py +++ /dev/null @@ -1,71 +0,0 @@ -# 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. -"""API Database migrations for instance_groups""" - -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import ForeignKey -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - groups = Table('instance_groups', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('user_id', String(length=255)), - Column('project_id', String(length=255)), - Column('uuid', String(length=36), nullable=False), - Column('name', String(length=255)), - UniqueConstraint('uuid', - name='uniq_instance_groups0uuid'), - mysql_engine='InnoDB', - mysql_charset='utf8', - ) - - groups.create(checkfirst=True) - - group_policy = Table('instance_group_policy', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('policy', String(length=255)), - Column('group_id', Integer, ForeignKey('instance_groups.id'), - nullable=False), - Index('instance_group_policy_policy_idx', 'policy'), - mysql_engine='InnoDB', - mysql_charset='utf8', - ) - - group_policy.create(checkfirst=True) - - group_member = Table('instance_group_member', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('instance_uuid', String(length=255)), - Column('group_id', Integer, ForeignKey('instance_groups.id'), - nullable=False), - Index('instance_group_member_instance_idx', 'instance_uuid'), - mysql_engine='InnoDB', - mysql_charset='utf8', - ) - - group_member.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/019_build_request_add_block_device_mapping.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/019_build_request_add_block_device_mapping.py deleted file mode 100644 index 7accbfcd5..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/019_build_request_add_block_device_mapping.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -from sqlalchemy import Column -from sqlalchemy import MetaData -from sqlalchemy import Table -from sqlalchemy import Text - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - build_requests = Table('build_requests', meta, autoload=True) - - if not hasattr(build_requests.c, 'block_device_mappings'): - build_requests.create_column(Column('block_device_mappings', Text())) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/020_block_device_mappings_mediumtext.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/020_block_device_mappings_mediumtext.py deleted file mode 100644 index d4a33cbd5..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/020_block_device_mappings_mediumtext.py +++ /dev/null @@ -1,24 +0,0 @@ -# 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. - -from sqlalchemy import MetaData -from sqlalchemy import Table - -from placement.db.sqlalchemy import api_models - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - build_requests = Table('build_requests', meta, autoload=True) - build_requests.c.block_device_mappings.alter(type=api_models.MediumText()) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/021_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/021_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/021_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/022_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/022_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/022_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/023_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/023_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/023_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/024_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/024_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/024_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/025_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/025_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/025_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/026_add_resource_classes.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/026_add_resource_classes.py deleted file mode 100644 index 0e48f53c8..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/026_add_resource_classes.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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. - -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - resource_classes = Table('resource_classes', meta, - Column('id', Integer, primary_key=True, nullable=False), - Column('name', String(length=255), nullable=False), - Column('created_at', DateTime), - Column('updated_at', DateTime), - UniqueConstraint('name', name='uniq_resource_classes0name'), - mysql_engine='InnoDB', - mysql_charset='latin1' - ) - - resource_classes.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/027_quotas.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/027_quotas.py deleted file mode 100644 index 8c95143c0..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/027_quotas.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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. -"""API Database migrations for quotas""" - -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import ForeignKey -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - quota_classes = Table('quota_classes', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('class_name', String(length=255)), - Column('resource', String(length=255)), - Column('hard_limit', Integer), - Index('quota_classes_class_name_idx', 'class_name'), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - quota_classes.create(checkfirst=True) - - quota_usages = Table('quota_usages', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('project_id', String(length=255)), - Column('resource', String(length=255), nullable=False), - Column('in_use', Integer, nullable=False), - Column('reserved', Integer, nullable=False), - Column('until_refresh', Integer), - Column('user_id', String(length=255)), - Index('quota_usages_project_id_idx', 'project_id'), - Index('quota_usages_user_id_idx', 'user_id'), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - quota_usages.create(checkfirst=True) - - quotas = Table('quotas', meta, - Column('id', Integer, primary_key=True, nullable=False), - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('project_id', String(length=255)), - Column('resource', String(length=255), nullable=False), - Column('hard_limit', Integer), - UniqueConstraint('project_id', 'resource', - name='uniq_quotas0project_id0resource'), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - quotas.create(checkfirst=True) - - uniq_name = "uniq_project_user_quotas0user_id0project_id0resource" - project_user_quotas = Table('project_user_quotas', meta, - Column('id', Integer, primary_key=True, - nullable=False), - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('user_id', - String(length=255), - nullable=False), - Column('project_id', - String(length=255), - nullable=False), - Column('resource', - String(length=255), - nullable=False), - Column('hard_limit', Integer, nullable=True), - UniqueConstraint('user_id', 'project_id', 'resource', - name=uniq_name), - Index('project_user_quotas_project_id_idx', - 'project_id'), - Index('project_user_quotas_user_id_idx', - 'user_id'), - mysql_engine='InnoDB', - mysql_charset='utf8', - ) - - project_user_quotas.create(checkfirst=True) - - reservations = Table('reservations', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('uuid', String(length=36), nullable=False), - Column('usage_id', Integer, ForeignKey('quota_usages.id'), - nullable=False), - Column('project_id', String(length=255)), - Column('resource', String(length=255)), - Column('delta', Integer, nullable=False), - Column('expire', DateTime), - Column('user_id', String(length=255)), - Index('reservations_project_id_idx', 'project_id'), - Index('reservations_uuid_idx', 'uuid'), - Index('reservations_expire_idx', 'expire'), - Index('reservations_user_id_idx', 'user_id'), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - - reservations.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/028_build_requests_instance_mediumtext.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/028_build_requests_instance_mediumtext.py deleted file mode 100644 index 345a62211..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/028_build_requests_instance_mediumtext.py +++ /dev/null @@ -1,24 +0,0 @@ -# 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. - -from sqlalchemy import MetaData -from sqlalchemy import Table - -from placement.db.sqlalchemy import api_models - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - build_requests = Table('build_requests', meta, autoload=True) - build_requests.c.instance.alter(type=api_models.MediumText()) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/029_aggregates.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/029_aggregates.py deleted file mode 100644 index 9dcdcdeb8..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/029_aggregates.py +++ /dev/null @@ -1,37 +0,0 @@ -# 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. -"""API Database migrations for placement_aggregates""" - -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - placement_aggregates = Table('placement_aggregates', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False), - Column('uuid', String(length=36), index=True), - UniqueConstraint('uuid', name='uniq_placement_aggregates0uuid'), - mysql_engine='InnoDB', - mysql_charset='latin1' - ) - - placement_aggregates.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/030_require_cell_setup.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/030_require_cell_setup.py deleted file mode 100644 index f425f3d9b..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/030_require_cell_setup.py +++ /dev/null @@ -1,59 +0,0 @@ -# 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. - -from oslo_log import log as logging -from sqlalchemy import MetaData, Table, func, select - -from placement import exception -from placement.i18n import _ -from placement import objects - -LOG = logging.getLogger(__name__) - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - flavors = Table('flavors', meta, autoload=True) - count = select([func.count()]).select_from(flavors).scalar() - if count == 0: - # NOTE(danms): We need to be careful here if this is a new - # installation, which can't possibly have any mappings. Check - # to see if any flavors are defined to determine if we are - # upgrading an existing system. If not, then don't obsess over - # the lack of mappings - return - - cell_mappings = Table('cell_mappings', meta, autoload=True) - count = select([func.count()]).select_from(cell_mappings).scalar() - # Two mappings are required at a minimum, cell0 and your first cell - if count < 2: - msg = _('Cell mappings are not created, but required for Ocata. ' - 'Please run nova-manage cell_v2 simple_cell_setup before ' - 'continuing.') - raise exception.ValidationError(detail=msg) - - count = select([func.count()]).select_from(cell_mappings).where( - cell_mappings.c.uuid == objects.CellMapping.CELL0_UUID).scalar() - if count != 1: - msg = _('A mapping for Cell0 was not found, but is required for ' - 'Ocata. Please run nova-manage cell_v2 simple_cell_setup ' - 'before continuing.') - raise exception.ValidationError(detail=msg) - - host_mappings = Table('host_mappings', meta, autoload=True) - count = select([func.count()]).select_from(host_mappings).scalar() - if count == 0: - LOG.warning('No host mappings were found, but are required for Ocata. ' - 'Please run nova-manage cell_v2 simple_cell_setup before ' - 'continuing.') diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/031_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/031_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/031_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/032_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/032_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/032_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/033_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/033_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/033_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/034_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/034_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/034_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/035_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/035_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/035_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/036_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/036_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/036_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/037_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/037_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/037_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/038_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/038_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/038_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/039_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/039_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/039_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/040_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/040_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/040_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/041_resource_provider_traits.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/041_resource_provider_traits.py deleted file mode 100644 index 03c1c311d..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/041_resource_provider_traits.py +++ /dev/null @@ -1,66 +0,0 @@ -# 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. -"""Database migrations for traits""" - -from migrate.changeset.constraint import ForeignKeyConstraint -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import ForeignKey -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import Table -from sqlalchemy import Unicode - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - if migrate_engine.name == 'mysql': - nameargs = {'collation': 'utf8_bin'} - else: - nameargs = {} - - resource_providers = Table('resource_providers', meta, autoload=True) - - traits = Table( - 'traits', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False, - autoincrement=True), - Column('name', Unicode(255, **nameargs), nullable=False), - UniqueConstraint('name', name='uniq_traits0name'), - mysql_engine='InnoDB', - mysql_charset='latin1' - ) - - resource_provider_traits = Table( - 'resource_provider_traits', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('trait_id', Integer, ForeignKey('traits.id'), primary_key=True, - nullable=False), - Column('resource_provider_id', Integer, primary_key=True, - nullable=False), - Index('resource_provider_traits_resource_provider_trait_idx', - 'resource_provider_id', 'trait_id'), - ForeignKeyConstraint(columns=['resource_provider_id'], - refcolumns=[resource_providers.c.id]), - mysql_engine='InnoDB', - mysql_charset='latin1' - ) - - for table in [traits, resource_provider_traits]: - table.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/042_build_requests_add_tags.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/042_build_requests_add_tags.py deleted file mode 100644 index 7c34fe398..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/042_build_requests_add_tags.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -from sqlalchemy import Column -from sqlalchemy import MetaData -from sqlalchemy import Table -from sqlalchemy import Text - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - build_requests = Table('build_requests', meta, autoload=True) - - if not hasattr(build_requests.c, 'tags'): - build_requests.create_column(Column('tags', Text())) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/043_consumers.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/043_consumers.py deleted file mode 100644 index 0504794bb..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/043_consumers.py +++ /dev/null @@ -1,44 +0,0 @@ -# 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. -"""Database migrations for consumers""" - -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - consumers = Table('consumers', meta, - Column('created_at', DateTime), - Column('updated_at', DateTime), - Column('id', Integer, primary_key=True, nullable=False, - autoincrement=True), - Column('uuid', String(length=36), nullable=False), - Column('project_id', String(length=255), nullable=False), - Column('user_id', String(length=255), nullable=False), - Index('consumers_project_id_uuid_idx', 'project_id', 'uuid'), - Index('consumers_project_id_user_id_uuid_idx', 'project_id', 'user_id', - 'uuid'), - UniqueConstraint('uuid', name='uniq_consumers0uuid'), - mysql_engine='InnoDB', - mysql_charset='latin1' - ) - - consumers.create(checkfirst=True) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/044_add_projects_users.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/044_add_projects_users.py deleted file mode 100644 index 142581071..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/044_add_projects_users.py +++ /dev/null @@ -1,72 +0,0 @@ -# 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. - -"""Streamlines consumers table and adds projects and users table""" - -from migrate import UniqueConstraint -from sqlalchemy import Column -from sqlalchemy import DateTime -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import String -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - projects = Table('projects', meta, - Column('id', Integer, primary_key=True, nullable=False, - autoincrement=True), - Column('external_id', String(length=255), nullable=False), - Column('created_at', DateTime), - Column('updated_at', DateTime), - UniqueConstraint('external_id', name='uniq_projects0external_id'), - mysql_engine='InnoDB', - mysql_charset='latin1' - ) - - projects.create(checkfirst=True) - - users = Table('users', meta, - Column('id', Integer, primary_key=True, nullable=False, - autoincrement=True), - Column('external_id', String(length=255), nullable=False), - Column('created_at', DateTime), - Column('updated_at', DateTime), - UniqueConstraint('external_id', name='uniq_users0external_id'), - mysql_engine='InnoDB', - mysql_charset='latin1' - ) - - users.create(checkfirst=True) - - consumers = Table('consumers', meta, autoload=True) - project_id_col = consumers.c.project_id - user_id_col = consumers.c.user_id - - # NOTE(jaypipes): For PostgreSQL, we can't do col.alter(type=Integer) - # because NVARCHAR and INTEGER are not compatible, so we need to do this - # manual ALTER TABLE ... USING approach. - if migrate_engine.name == 'postgresql': - migrate_engine.execute( - "ALTER TABLE consumers ALTER COLUMN project_id " - "TYPE INTEGER USING project_id::integer" - ) - migrate_engine.execute( - "ALTER TABLE consumers ALTER COLUMN user_id " - "TYPE INTEGER USING user_id::integer" - ) - else: - project_id_col.alter(type=Integer) - user_id_col.alter(type=Integer) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/045_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/045_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/045_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/046_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/046_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/046_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/047_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/047_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/047_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/048_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/048_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/048_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/049_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/049_placeholder.py deleted file mode 100644 index a5d6ecd3a..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/049_placeholder.py +++ /dev/null @@ -1,23 +0,0 @@ - -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/050_flavors_add_description.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/050_flavors_add_description.py deleted file mode 100644 index 052914020..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/050_flavors_add_description.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -from sqlalchemy import Column -from sqlalchemy import MetaData -from sqlalchemy import Table -from sqlalchemy import Text - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - flavors = Table('flavors', meta, autoload=True) - - if not hasattr(flavors.c, 'description'): - flavors.create_column(Column('description', Text())) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/051_nested_resource_providers.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/051_nested_resource_providers.py deleted file mode 100644 index 4745a1341..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/051_nested_resource_providers.py +++ /dev/null @@ -1,50 +0,0 @@ -# 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. - -from sqlalchemy import Column -from sqlalchemy import ForeignKey -from sqlalchemy import Index -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - resource_providers = Table('resource_providers', meta, autoload=True) - columns_to_add = [ - ('root_provider_id', - Column('root_provider_id', Integer, - ForeignKey('resource_providers.id'))), - ('parent_provider_id', - Column('parent_provider_id', Integer, - ForeignKey('resource_providers.id'))), - ] - for col_name, column in columns_to_add: - if not hasattr(resource_providers.c, col_name): - resource_providers.create_column(column) - - indexed_columns = set() - for idx in resource_providers.indexes: - for c in idx.columns: - indexed_columns.add(c.name) - - if 'root_provider_id' not in indexed_columns: - index = Index('resource_providers_root_provider_id_idx', - resource_providers.c.root_provider_id) - index.create() - if 'parent_provider_id' not in indexed_columns: - index = Index('resource_providers_parent_provider_id_idx', - resource_providers.c.parent_provider_id) - index.create() diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/052_request_specs_spec_mediumtext.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/052_request_specs_spec_mediumtext.py deleted file mode 100644 index fa5660df7..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/052_request_specs_spec_mediumtext.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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. - -from sqlalchemy import MetaData -from sqlalchemy import Table - -from placement.db.sqlalchemy import api_models - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - request_specs = Table('request_specs', meta, autoload=True) - if request_specs.c.spec.type != api_models.MediumText(): - request_specs.c.spec.alter(type=api_models.MediumText()) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/053_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/053_placeholder.py deleted file mode 100644 index 7a9322450..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/053_placeholder.py +++ /dev/null @@ -1,22 +0,0 @@ -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/054_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/054_placeholder.py deleted file mode 100644 index 7a9322450..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/054_placeholder.py +++ /dev/null @@ -1,22 +0,0 @@ -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/055_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/055_placeholder.py deleted file mode 100644 index 7a9322450..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/055_placeholder.py +++ /dev/null @@ -1,22 +0,0 @@ -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/056_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/056_placeholder.py deleted file mode 100644 index 7a9322450..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/056_placeholder.py +++ /dev/null @@ -1,22 +0,0 @@ -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/057_placeholder.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/057_placeholder.py deleted file mode 100644 index 7a9322450..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/057_placeholder.py +++ /dev/null @@ -1,22 +0,0 @@ -# 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. - -# This is a placeholder for backports. -# Do not use this number for new work. New work starts after -# all the placeholders. -# -# See this for more information: -# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html - - -def upgrade(migrate_engine): - pass diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/058_cell_mapping_add_disabled.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/058_cell_mapping_add_disabled.py deleted file mode 100644 index 9fd45b99e..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/058_cell_mapping_add_disabled.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -from sqlalchemy import Boolean -from sqlalchemy import Column -from sqlalchemy import MetaData -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - cell_mappings = Table('cell_mappings', meta, autoload=True) - - if not hasattr(cell_mappings.c, 'disabled'): - cell_mappings.create_column(Column('disabled', Boolean, default=False)) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/059_add_consumer_generation.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/059_add_consumer_generation.py deleted file mode 100644 index bae9c8fb6..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/059_add_consumer_generation.py +++ /dev/null @@ -1,29 +0,0 @@ -# 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. - -from sqlalchemy import Column -from sqlalchemy import Integer -from sqlalchemy import MetaData -from sqlalchemy import Table -from sqlalchemy import text - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - consumers = Table("consumers", meta, autoload=True) - if not hasattr(consumers.c, "generation"): - # This is adding a column to an existing table, so the server_default - # bit will make existing rows 0 for that column. - consumers.create_column(Column("generation", Integer, default=0, - server_default=text("0"), nullable=False)) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/060_instance_group_policy_add_rules.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/060_instance_group_policy_add_rules.py deleted file mode 100644 index 116432110..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/060_instance_group_policy_add_rules.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -from sqlalchemy import Column -from sqlalchemy import MetaData -from sqlalchemy import Table -from sqlalchemy import Text - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - policies = Table('instance_group_policy', meta, autoload=True) - - if not hasattr(policies.c, 'rules'): - policies.create_column(Column('rules', Text)) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/061_instance_mapping_add_queued_for_delete.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/061_instance_mapping_add_queued_for_delete.py deleted file mode 100644 index cedda1dbb..000000000 --- a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/061_instance_mapping_add_queued_for_delete.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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. - -from sqlalchemy import Boolean -from sqlalchemy import Column -from sqlalchemy import MetaData -from sqlalchemy import Table - - -def upgrade(migrate_engine): - meta = MetaData() - meta.bind = migrate_engine - - instance_mappings = Table('instance_mappings', meta, autoload=True) - - if not hasattr(instance_mappings.c, 'queued_for_delete'): - instance_mappings.create_column(Column('queued_for_delete', Boolean, - default=False)) diff --git a/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/__init__.py b/placement/db/sqlalchemy/api_migrations/migrate_repo/versions/__init__.py deleted file mode 100644 index e69de29bb..000000000