From 9da15bf32a62792327adccb8044f377cb5578597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Douglas=20Mendiz=C3=A1bal?= Date: Wed, 23 Sep 2020 08:04:45 -0500 Subject: [PATCH] Rebase alembic migrations This patch squashes all database migrations up to and including the Ocata release into a single migration. By squashing the migrations into a single one, we are able to fix the migration issues in MySQL 8.0+. There has only been one database migration since Ocata, which was not changed, and any existing database will be compatible with this change. This patch also unblocks testing in Ubuntu Focal, which uses MySQL 8.0 as its default database. Change-Id: I66c4c5dc91ac3fe486784600d4f58ef4ddb8484c Story: 2007732 Task: 39896 --- .zuul.yaml | 6 - ...e7fa_remove_transport_keys_column_from_.py | 30 - ...9afa_create_secret_store_metadata_table.py | 50 -- ...43_add_project_column_to_consumer_table.py | 46 -- ...ill_project_id_to_secrets_where_missing.py | 73 --- .../versions/1a0c2cdafb38_initial_version.py | 28 - ...9e3_new_secret_and_container_acl_tables.py | 118 ---- .../1bc885808c76_add_project_id_to_secrets.py | 36 -- ...1bece815014f_remove_projectsecret_table.py | 30 - ...fce0_fixing_composite_primary_keys_and_.py | 97 ---- ...d_add_new_columns_type_meta_containerid.py | 37 -- ...85_removing_redundant_fields_from_order.py | 35 -- ..._change_keystone_id_for_external_id_in_.py | 33 -- ...d6469f25_add_sub_status_info_for_orders.py | 36 -- ...1bde_dsa_in_container_type_modelbase_to.py | 49 -- .../2d21598e7e70_added_ca_related_tables.py | 116 ---- ...remove_size_limits_on_meta_table_values.py | 41 -- ...a269cc64_update_order_retry_tasks_table.py | 64 --- .../39a96e67e990_add_missing_constraints.py | 47 -- ...5cba_model_for_multiple_backend_support.py | 75 --- .../versions/39cf2e645cba_ocata_rebase.py | 530 ++++++++++++++++++ ...e_add_owning_project_and_creator_to_cas.py | 38 -- ...b88af_add_order_barbican_metadata_table.py | 48 -- ...2_add_orders_plugin_metadata_table_and_.py | 48 -- ...ac_added_secret_type_column_to_secrets_.py | 32 -- .../46b98cde536_add_project_quotas_table.py | 58 -- ...451_made_plugin_names_in_kek_datum_non_.py | 32 -- ..._add_cas_column_to_project_quotas_table.py | 33 -- ...7a3_rename_acl_creator_only_to_project_.py | 45 -- .../795737bb3c3_change_tenants_to_projects.py | 95 ---- .../aa2cf96a1d5_add_orderretrytask.py | 43 -- .../cd4106a1a0_add_cert_to_container_type.py | 34 -- .../d2780d5aa510_change_url_length.py | 35 -- .../dce488646127_add_secret_user_metadata.py | 52 -- .../versions/juno_initial.py | 44 -- .../versions/kilo_release.py | 31 - ...xed-mysql-migrations-23221671ba17ea5e.yaml | 4 + 37 files changed, 534 insertions(+), 1715 deletions(-) delete mode 100644 barbican/model/migration/alembic_migrations/versions/10220ccbe7fa_remove_transport_keys_column_from_.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/13d127569afa_create_secret_store_metadata_table.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/156cd9933643_add_project_column_to_consumer_table.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/161f8aceb687_fill_project_id_to_secrets_where_missing.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/1a0c2cdafb38_initial_version.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/1a7cf79559e3_new_secret_and_container_acl_tables.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/1bc885808c76_add_project_id_to_secrets.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/1bece815014f_remove_projectsecret_table.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/1c0f328bfce0_fixing_composite_primary_keys_and_.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/1e86c18af2dd_add_new_columns_type_meta_containerid.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/254495565185_removing_redundant_fields_from_order.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/256da65e0c5f_change_keystone_id_for_external_id_in_.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/2843d6469f25_add_sub_status_info_for_orders.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/2ab3f5371bde_dsa_in_container_type_modelbase_to.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/2d21598e7e70_added_ca_related_tables.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/3041b53b95d7_remove_size_limits_on_meta_table_values.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/30dba269cc64_update_order_retry_tasks_table.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/39a96e67e990_add_missing_constraints.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/39cf2e645cba_model_for_multiple_backend_support.py create mode 100644 barbican/model/migration/alembic_migrations/versions/39cf2e645cba_ocata_rebase.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/3c3b04040bfe_add_owning_project_and_creator_to_cas.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/3d36a26b88af_add_order_barbican_metadata_table.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/4070806f6972_add_orders_plugin_metadata_table_and_.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/443d6f4a69ac_added_secret_type_column_to_secrets_.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/46b98cde536_add_project_quotas_table.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/47b69e523451_made_plugin_names_in_kek_datum_non_.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/4ecde3a3a72a_add_cas_column_to_project_quotas_table.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/6a4457517a3_rename_acl_creator_only_to_project_.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/795737bb3c3_change_tenants_to_projects.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/aa2cf96a1d5_add_orderretrytask.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/cd4106a1a0_add_cert_to_container_type.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/d2780d5aa510_change_url_length.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/dce488646127_add_secret_user_metadata.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/juno_initial.py delete mode 100644 barbican/model/migration/alembic_migrations/versions/kilo_release.py create mode 100644 releasenotes/notes/fixed-mysql-migrations-23221671ba17ea5e.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 00ee02fd2..b0087cdc3 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -2,12 +2,6 @@ - job: name: barbican-tox-functional parent: devstack-tox-functional - # TODO(gmann): Remove the below nodeset setting to Bionic once - # https://storyboard.openstack.org/#!/story/2007732 is fixed - # Once nodeset is removed form here then devstack-tox-functional job - # will automatically run this job on Ubuntu Focal nodeset from - # Victoria gate onwards. - nodeset: openstack-single-node-bionic description: Functional testing required-projects: - name: openstack/barbican diff --git a/barbican/model/migration/alembic_migrations/versions/10220ccbe7fa_remove_transport_keys_column_from_.py b/barbican/model/migration/alembic_migrations/versions/10220ccbe7fa_remove_transport_keys_column_from_.py deleted file mode 100644 index b2a1f9b15..000000000 --- a/barbican/model/migration/alembic_migrations/versions/10220ccbe7fa_remove_transport_keys_column_from_.py +++ /dev/null @@ -1,30 +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. - -"""Remove transport keys column from project quotas table - -Revision ID: 10220ccbe7fa -Revises: 3c3b04040bfe -Create Date: 2015-09-09 09:10:23.812681 - -""" - -# revision identifiers, used by Alembic. -revision = '10220ccbe7fa' -down_revision = '3c3b04040bfe' - -from alembic import op - - -def upgrade(): - op.drop_column('project_quotas', 'transport_keys') diff --git a/barbican/model/migration/alembic_migrations/versions/13d127569afa_create_secret_store_metadata_table.py b/barbican/model/migration/alembic_migrations/versions/13d127569afa_create_secret_store_metadata_table.py deleted file mode 100644 index e38759fb8..000000000 --- a/barbican/model/migration/alembic_migrations/versions/13d127569afa_create_secret_store_metadata_table.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -"""create_secret_store_metadata_table - -Revision ID: 13d127569afa -Revises: juno -Create Date: 2014-04-24 13:15:41.858266 - -""" - -# revision identifiers, used by Alembic. -revision = '13d127569afa' -down_revision = 'juno' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - ctx = op.get_context() - con = op.get_bind() - table_exists = ctx.dialect.has_table(con.engine, 'secret_store_metadata') - if not table_exists: - op.create_table( - 'secret_store_metadata', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('secret_id', sa.String(length=36), nullable=False), - sa.Column('key', sa.String(length=255), nullable=False), - sa.Column('value', sa.String(length=255), nullable=False), - sa.ForeignKeyConstraint(['secret_id'], ['secrets.id'],), - sa.PrimaryKeyConstraint('id'), - ) diff --git a/barbican/model/migration/alembic_migrations/versions/156cd9933643_add_project_column_to_consumer_table.py b/barbican/model/migration/alembic_migrations/versions/156cd9933643_add_project_column_to_consumer_table.py deleted file mode 100644 index 67ac11cfa..000000000 --- a/barbican/model/migration/alembic_migrations/versions/156cd9933643_add_project_column_to_consumer_table.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. - -"""Add project column to consumer table - -Revision ID: 156cd9933643 -Revises: 46b98cde536 -Create Date: 2015-08-28 20:53:23.205128 - -""" - -# revision identifiers, used by Alembic. -revision = '156cd9933643' -down_revision = '46b98cde536' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.add_column( - 'container_consumer_metadata', - sa.Column('project_id', - sa.String(length=36), - nullable=True)) - op.create_index( - op.f('ix_container_consumer_metadata_project_id'), - 'container_consumer_metadata', - ['project_id'], - unique=False) - op.create_foreign_key( - None, - 'container_consumer_metadata', - 'projects', - ['project_id'], - ['id']) diff --git a/barbican/model/migration/alembic_migrations/versions/161f8aceb687_fill_project_id_to_secrets_where_missing.py b/barbican/model/migration/alembic_migrations/versions/161f8aceb687_fill_project_id_to_secrets_where_missing.py deleted file mode 100644 index 9e2c41fcb..000000000 --- a/barbican/model/migration/alembic_migrations/versions/161f8aceb687_fill_project_id_to_secrets_where_missing.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. - -"""fill project_id to secrets where missing - -Revision ID: 161f8aceb687 -Revises: 1bc885808c76 -Create Date: 2015-06-22 15:58:03.131256 - -""" - -# revision identifiers, used by Alembic. -revision = '161f8aceb687' -down_revision = '1bc885808c76' - -from alembic import op -import sqlalchemy as sa - - -def _get_database_metadata(): - con = op.get_bind() - metadata = sa.MetaData(bind=con) - metadata.reflect() - return metadata - - -def _drop_constraint(ctx, name, table): - if ctx.dialect.name == 'mysql': - # MySQL won't allow some operations with constraints in place - op.drop_constraint(name, table, type_='foreignkey') - - -def _create_constraint(ctx, name, tableone, tabletwo, columnone, columntwo): - if ctx.dialect.name == 'mysql': - # Recreate foreign key constraint - op.create_foreign_key(name, tableone, tabletwo, columnone, columntwo) - - -def upgrade(): - metadata = _get_database_metadata() - - # Get relevant tables - secrets = metadata.tables['secrets'] - project_secret = metadata.tables['project_secret'] - - # Add project_id to the secrets - op.execute(secrets.update(). - values({'project_id': project_secret.c.project_id}). - where(secrets.c.id == project_secret.c.secret_id). - where(secrets.c.project_id == None) # noqa - ) - - # Need to drop foreign key constraint before mysql will allow changes - ctx = op.get_context() - _drop_constraint(ctx, 'secrets_project_fk', 'secrets') - - # make project_id no longer nullable - op.alter_column('secrets', 'project_id', - type_=sa.String(36), nullable=False) - - # Create foreign key constraint again - _create_constraint(ctx, 'secrets_project_fk', 'secrets', 'projects', - ['project_id'], ['id']) diff --git a/barbican/model/migration/alembic_migrations/versions/1a0c2cdafb38_initial_version.py b/barbican/model/migration/alembic_migrations/versions/1a0c2cdafb38_initial_version.py deleted file mode 100644 index 102b849c4..000000000 --- a/barbican/model/migration/alembic_migrations/versions/1a0c2cdafb38_initial_version.py +++ /dev/null @@ -1,28 +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. - -"""create test table - - Revision ID: 1a0c2cdafb38 - Revises: juno - Create Date: 2013-06-17 16:42:13.634746 - -""" - -# revision identifiers, used by Alembic. -revision = '1a0c2cdafb38' -down_revision = None - - -def upgrade(): - pass diff --git a/barbican/model/migration/alembic_migrations/versions/1a7cf79559e3_new_secret_and_container_acl_tables.py b/barbican/model/migration/alembic_migrations/versions/1a7cf79559e3_new_secret_and_container_acl_tables.py deleted file mode 100644 index 22f091417..000000000 --- a/barbican/model/migration/alembic_migrations/versions/1a7cf79559e3_new_secret_and_container_acl_tables.py +++ /dev/null @@ -1,118 +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. - -"""New secret and container ACL tables - -Revision ID: 1a7cf79559e3 -Revises: 1c0f328bfce0 -Create Date: 2015-04-01 13:31:04.292754 - -""" - -# revision identifiers, used by Alembic. -revision = '1a7cf79559e3' -down_revision = '1c0f328bfce0' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - ctx = op.get_context() - con = op.get_bind() - table_exists = ctx.dialect.has_table(con.engine, 'secret_acls') - if not table_exists: - op.create_table( - 'secret_acls', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('secret_id', sa.String(length=36), nullable=False), - sa.Column('operation', sa.String(length=255), nullable=False), - sa.Column('creator_only', sa.Boolean(), nullable=False), - sa.ForeignKeyConstraint(['secret_id'], ['secrets.id'],), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('secret_id', 'operation', - name='_secret_acl_operation_uc') - ) - op.create_index(op.f('ix_secret_acls_secret_id'), 'secret_acls', - ['secret_id'], unique=False) - - table_exists = ctx.dialect.has_table(con.engine, 'container_acls') - if not table_exists: - op.create_table( - 'container_acls', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('container_id', sa.String(length=36), nullable=False), - sa.Column('operation', sa.String(length=255), nullable=False), - sa.Column('creator_only', sa.Boolean(), nullable=False), - sa.ForeignKeyConstraint(['container_id'], ['containers.id'],), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('container_id', 'operation', - name='_container_acl_operation_uc') - ) - op.create_index(op.f('ix_container_acls_container_id'), - 'container_acls', ['container_id'], unique=False) - table_exists = ctx.dialect.has_table(con.engine, 'secret_acl_users') - if not table_exists: - op.create_table( - 'secret_acl_users', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('acl_id', sa.String(length=36), nullable=False), - sa.Column('user_id', sa.String(length=255), nullable=False), - sa.ForeignKeyConstraint(['acl_id'], ['secret_acls.id'],), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('acl_id', 'user_id', - name='_secret_acl_user_uc') - ) - op.create_index(op.f('ix_secret_acl_users_acl_id'), 'secret_acl_users', - ['acl_id'], unique=False) - table_exists = ctx.dialect.has_table(con.engine, 'container_acl_users') - if not table_exists: - op.create_table( - 'container_acl_users', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('acl_id', sa.String(length=36), nullable=False), - sa.Column('user_id', sa.String(length=255), nullable=False), - sa.ForeignKeyConstraint(['acl_id'], ['container_acls.id'],), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('acl_id', 'user_id', - name='_container_acl_user_uc') - ) - op.create_index(op.f('ix_container_acl_users_acl_id'), - 'container_acl_users', ['acl_id'], unique=False) - - op.add_column(u'containers', sa.Column('creator_id', sa.String(length=255), - nullable=True)) - op.add_column(u'orders', sa.Column('creator_id', sa.String(length=255), - nullable=True)) - op.add_column(u'secrets', sa.Column('creator_id', sa.String(length=255), - nullable=True)) diff --git a/barbican/model/migration/alembic_migrations/versions/1bc885808c76_add_project_id_to_secrets.py b/barbican/model/migration/alembic_migrations/versions/1bc885808c76_add_project_id_to_secrets.py deleted file mode 100644 index 2f06b400e..000000000 --- a/barbican/model/migration/alembic_migrations/versions/1bc885808c76_add_project_id_to_secrets.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. - -"""Add project id to Secrets - -Revision ID: 1bc885808c76 -Revises: 6a4457517a3 -Create Date: 2015-04-24 13:53:29.926426 - -""" - -# revision identifiers, used by Alembic. -revision = '1bc885808c76' -down_revision = '6a4457517a3' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.add_column('secrets', sa.Column('project_id', sa.String(length=36), - nullable=True)) - op.create_index(op.f('ix_secrets_project_id'), 'secrets', ['project_id'], - unique=False) - op.create_foreign_key('secrets_project_fk', 'secrets', 'projects', - ['project_id'], ['id']) diff --git a/barbican/model/migration/alembic_migrations/versions/1bece815014f_remove_projectsecret_table.py b/barbican/model/migration/alembic_migrations/versions/1bece815014f_remove_projectsecret_table.py deleted file mode 100644 index a69eb986a..000000000 --- a/barbican/model/migration/alembic_migrations/versions/1bece815014f_remove_projectsecret_table.py +++ /dev/null @@ -1,30 +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. - -"""remove ProjectSecret table - -Revision ID: 1bece815014f -Revises: 161f8aceb687 -Create Date: 2015-06-23 16:17:50.805295 - -""" - -# revision identifiers, used by Alembic. -revision = '1bece815014f' -down_revision = '161f8aceb687' - -from alembic import op - - -def upgrade(): - op.drop_table('project_secret') diff --git a/barbican/model/migration/alembic_migrations/versions/1c0f328bfce0_fixing_composite_primary_keys_and_.py b/barbican/model/migration/alembic_migrations/versions/1c0f328bfce0_fixing_composite_primary_keys_and_.py deleted file mode 100644 index 46d11fbf0..000000000 --- a/barbican/model/migration/alembic_migrations/versions/1c0f328bfce0_fixing_composite_primary_keys_and_.py +++ /dev/null @@ -1,97 +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. - -"""Fixing composite primary keys and adding indexes to foreign key - -Revision ID: 1c0f328bfce0 -Revises: 3d36a26b88af -Create Date: 2015-03-04 17:09:41.479708 - -""" - -# revision identifiers, used by Alembic. -revision = '1c0f328bfce0' -down_revision = '2d21598e7e70' - -from alembic import op -import sqlalchemy as sa - - -def _drop_constraint(ctx, name, table): - if ctx.dialect.name == 'mysql': - # MySQL won't allow some operations with constraints in place - op.drop_constraint(name, table, type_='foreignkey') - - -def upgrade(): - op.create_index(op.f('ix_certificate_authority_metadata_ca_id'), - 'certificate_authority_metadata', ['ca_id'], unique=False) - op.create_index(op.f('ix_certificate_authority_metadata_key'), - 'certificate_authority_metadata', ['key'], unique=False) - op.create_index(op.f('ix_container_consumer_metadata_container_id'), - 'container_consumer_metadata', ['container_id'], - unique=False) - op.create_index(op.f('ix_container_secret_container_id'), - 'container_secret', ['container_id'], unique=False) - op.create_index(op.f('ix_container_secret_secret_id'), - 'container_secret', ['secret_id'], unique=False) - op.create_index(op.f('ix_containers_project_id'), - 'containers', ['project_id'], unique=False) - op.create_index(op.f('ix_encrypted_data_kek_id'), - 'encrypted_data', ['kek_id'], unique=False) - op.create_index(op.f('ix_encrypted_data_secret_id'), - 'encrypted_data', ['secret_id'], unique=False) - op.create_index(op.f('ix_kek_data_project_id'), - 'kek_data', ['project_id'], unique=False) - op.create_index(op.f('ix_order_barbican_metadata_order_id'), - 'order_barbican_metadata', ['order_id'], unique=False) - op.create_index(op.f('ix_order_plugin_metadata_order_id'), - 'order_plugin_metadata', ['order_id'], unique=False) - op.create_index(op.f('ix_order_retry_tasks_order_id'), - 'order_retry_tasks', ['order_id'], unique=False) - op.create_index(op.f('ix_orders_container_id'), - 'orders', ['container_id'], unique=False) - op.create_index(op.f('ix_orders_project_id'), - 'orders', ['project_id'], unique=False) - op.create_index(op.f('ix_orders_secret_id'), - 'orders', ['secret_id'], unique=False) - - ctx = op.get_context() - _drop_constraint(ctx, 'preferred_certificate_authorities_ibfk_1', - 'preferred_certificate_authorities') - - op.alter_column('preferred_certificate_authorities', 'ca_id', - existing_type=sa.VARCHAR(length=36), - nullable=False) - - op.create_foreign_key('preferred_certificate_authorities_fk', - 'preferred_certificate_authorities', - 'certificate_authorities', ['ca_id'], ['id']) - - op.create_index(op.f('ix_preferred_certificate_authorities_ca_id'), - 'preferred_certificate_authorities', ['ca_id'], - unique=False) - op.create_index(op.f('ix_preferred_certificate_authorities_project_id'), - 'preferred_certificate_authorities', ['project_id'], - unique=True) - op.create_index(op.f('ix_project_certificate_authorities_ca_id'), - 'project_certificate_authorities', ['ca_id'], unique=False) - op.create_index(op.f('ix_project_certificate_authorities_project_id'), - 'project_certificate_authorities', ['project_id'], - unique=False) - op.create_index(op.f('ix_project_secret_project_id'), - 'project_secret', ['project_id'], unique=False) - op.create_index(op.f('ix_project_secret_secret_id'), - 'project_secret', ['secret_id'], unique=False) - op.create_index(op.f('ix_secret_store_metadata_secret_id'), - 'secret_store_metadata', ['secret_id'], unique=False) diff --git a/barbican/model/migration/alembic_migrations/versions/1e86c18af2dd_add_new_columns_type_meta_containerid.py b/barbican/model/migration/alembic_migrations/versions/1e86c18af2dd_add_new_columns_type_meta_containerid.py deleted file mode 100644 index a8a973e4d..000000000 --- a/barbican/model/migration/alembic_migrations/versions/1e86c18af2dd_add_new_columns_type_meta_containerid.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. - -"""add new columns type meta containerId - -Revision ID: 1e86c18af2dd -Revises: 13d127569afa -Create Date: 2014-06-04 09:53:27.116054 - -""" - -# revision identifiers, used by Alembic. -revision = '1e86c18af2dd' -down_revision = '13d127569afa' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.add_column('orders', - sa.Column('container_id', sa.String(length=36), - nullable=True)) - op.add_column('orders', sa.Column('meta', sa.Text, nullable=True)) - op.add_column('orders', - sa.Column('type', sa.String(length=255), - nullable=True)) diff --git a/barbican/model/migration/alembic_migrations/versions/254495565185_removing_redundant_fields_from_order.py b/barbican/model/migration/alembic_migrations/versions/254495565185_removing_redundant_fields_from_order.py deleted file mode 100644 index 16e12e48f..000000000 --- a/barbican/model/migration/alembic_migrations/versions/254495565185_removing_redundant_fields_from_order.py +++ /dev/null @@ -1,35 +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. - -"""removing redundant fields from order - -Revision ID: 254495565185 -Revises: 2843d6469f25 -Create Date: 2014-09-16 12:09:23.716390 - -""" - -# revision identifiers, used by Alembic. -revision = '254495565185' -down_revision = '2843d6469f25' - -from alembic import op - - -def upgrade(): - op.drop_column('orders', 'secret_mode') - op.drop_column('orders', 'secret_algorithm') - op.drop_column('orders', 'secret_bit_length') - op.drop_column('orders', 'secret_expiration') - op.drop_column('orders', 'secret_payload_content_type') - op.drop_column('orders', 'secret_name') diff --git a/barbican/model/migration/alembic_migrations/versions/256da65e0c5f_change_keystone_id_for_external_id_in_.py b/barbican/model/migration/alembic_migrations/versions/256da65e0c5f_change_keystone_id_for_external_id_in_.py deleted file mode 100644 index 65d205c4d..000000000 --- a/barbican/model/migration/alembic_migrations/versions/256da65e0c5f_change_keystone_id_for_external_id_in_.py +++ /dev/null @@ -1,33 +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. - -"""Change keystone_id for external_id in Project model - -Revision ID: 256da65e0c5f -Revises: 795737bb3c3 -Create Date: 2014-12-22 03:55:29.072375 - -""" - -# revision identifiers, used by Alembic. -revision = '256da65e0c5f' -down_revision = '795737bb3c3' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.alter_column('projects', 'keystone_id', - type_=sa.String(36), - new_column_name='external_id') diff --git a/barbican/model/migration/alembic_migrations/versions/2843d6469f25_add_sub_status_info_for_orders.py b/barbican/model/migration/alembic_migrations/versions/2843d6469f25_add_sub_status_info_for_orders.py deleted file mode 100644 index 5900e59ba..000000000 --- a/barbican/model/migration/alembic_migrations/versions/2843d6469f25_add_sub_status_info_for_orders.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. - -"""add sub status info for orders - -Revision ID: 2843d6469f25 -Revises: 2ab3f5371bde -Create Date: 2014-09-16 12:31:15.181380 - -""" - -# revision identifiers, used by Alembic. -revision = '2843d6469f25' -down_revision = '2ab3f5371bde' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.add_column('orders', - sa.Column('sub_status', sa.String(length=36), - nullable=True)) - op.add_column('orders', - sa.Column('sub_status_message', sa.String(length=255), - nullable=True)) diff --git a/barbican/model/migration/alembic_migrations/versions/2ab3f5371bde_dsa_in_container_type_modelbase_to.py b/barbican/model/migration/alembic_migrations/versions/2ab3f5371bde_dsa_in_container_type_modelbase_to.py deleted file mode 100644 index 36d7a6927..000000000 --- a/barbican/model/migration/alembic_migrations/versions/2ab3f5371bde_dsa_in_container_type_modelbase_to.py +++ /dev/null @@ -1,49 +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. - -"""dsa in container type modelbase_to - -Revision ID: 2ab3f5371bde -Revises: 4070806f6972 -Create Date: 2014-09-02 12:11:43.524247 - -""" - -# revision identifiers, used by Alembic. -revision = '2ab3f5371bde' -down_revision = '4070806f6972' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.add_column('container_secret', - sa.Column('created_at', sa.DateTime(), nullable=False)) - op.add_column('container_secret', - sa.Column('deleted', sa.Boolean(), nullable=False)) - op.add_column('container_secret', - sa.Column('deleted_at', sa.DateTime(), nullable=True)) - op.add_column('container_secret', - sa.Column('id', sa.String(length=36), nullable=False)) - op.add_column('container_secret', - sa.Column('status', sa.String(length=20), nullable=False)) - op.add_column('container_secret', - sa.Column('updated_at', sa.DateTime(), nullable=False)) - - op.create_primary_key('pk_container_secret', 'container_secret', ['id']) - op.create_unique_constraint( - '_container_secret_name_uc', - 'container_secret', - ['container_id', 'secret_id', 'name'] - ) diff --git a/barbican/model/migration/alembic_migrations/versions/2d21598e7e70_added_ca_related_tables.py b/barbican/model/migration/alembic_migrations/versions/2d21598e7e70_added_ca_related_tables.py deleted file mode 100644 index 165210590..000000000 --- a/barbican/model/migration/alembic_migrations/versions/2d21598e7e70_added_ca_related_tables.py +++ /dev/null @@ -1,116 +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. - -"""Added CA related tables - -Revision ID: 2d21598e7e70 -Revises: 3d36a26b88af -Create Date: 2015-03-11 15:47:32.292944 - -""" - -# revision identifiers, used by Alembic. -revision = '2d21598e7e70' -down_revision = '3d36a26b88af' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - ctx = op.get_context() - con = op.get_bind() - - table_exists = ctx.dialect.has_table(con.engine, 'certificate_authorities') - if not table_exists: - op.create_table( - 'certificate_authorities', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('plugin_name', sa.String(length=255), nullable=False), - sa.Column('plugin_ca_id', sa.Text(), nullable=False), - sa.Column('expiration', sa.DateTime(), nullable=True), - sa.PrimaryKeyConstraint('id') - ) - - table_exists = ctx.dialect.has_table( - con.engine, - 'project_certificate_authorities') - if not table_exists: - op.create_table( - 'project_certificate_authorities', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('project_id', sa.String(length=36), nullable=False), - sa.Column('ca_id', sa.String(length=36), nullable=False), - sa.ForeignKeyConstraint(['ca_id'], - ['certificate_authorities.id'],), - sa.ForeignKeyConstraint(['project_id'], ['projects.id'],), - sa.PrimaryKeyConstraint('id', 'project_id', 'ca_id'), - sa.UniqueConstraint('project_id', - 'ca_id', - name='_project_certificate_authority_uc') - ) - - table_exists = ctx.dialect.has_table( - con.engine, - 'certificate_authority_metadata') - if not table_exists: - op.create_table( - 'certificate_authority_metadata', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('key', sa.String(length=255), nullable=False), - sa.Column('value', sa.String(length=255), nullable=False), - sa.Column('ca_id', sa.String(length=36), nullable=False), - sa.ForeignKeyConstraint(['ca_id'], - ['certificate_authorities.id'],), - sa.PrimaryKeyConstraint('id', 'key', 'ca_id'), - sa.UniqueConstraint('ca_id', - 'key', - name='_certificate_authority_metadatum_uc') - ) - - table_exists = ctx.dialect.has_table( - con.engine, - 'preferred_certificate_authorities') - - if not table_exists: - op.create_table( - 'preferred_certificate_authorities', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('project_id', sa.String(length=36), nullable=False), - sa.Column('ca_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['ca_id'], - ['certificate_authorities.id'],), - sa.ForeignKeyConstraint(['project_id'], ['projects.id'],), - sa.PrimaryKeyConstraint('id', 'project_id'), - sa.UniqueConstraint('project_id') - ) diff --git a/barbican/model/migration/alembic_migrations/versions/3041b53b95d7_remove_size_limits_on_meta_table_values.py b/barbican/model/migration/alembic_migrations/versions/3041b53b95d7_remove_size_limits_on_meta_table_values.py deleted file mode 100644 index e11bfab34..000000000 --- a/barbican/model/migration/alembic_migrations/versions/3041b53b95d7_remove_size_limits_on_meta_table_values.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. - -"""Remove size limits on meta table values - -Revision ID: 3041b53b95d7 -Revises: 1a7cf79559e3 -Create Date: 2015-04-08 15:43:32.852529 - -""" - -# revision identifiers, used by Alembic. -revision = '3041b53b95d7' -down_revision = '1a7cf79559e3' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.alter_column( - 'order_barbican_metadata', - 'value', - type_=sa.Text() - ) - - op.alter_column( - 'certificate_authority_metadata', - 'value', - type_=sa.Text() - ) diff --git a/barbican/model/migration/alembic_migrations/versions/30dba269cc64_update_order_retry_tasks_table.py b/barbican/model/migration/alembic_migrations/versions/30dba269cc64_update_order_retry_tasks_table.py deleted file mode 100644 index 7f8a4b1d0..000000000 --- a/barbican/model/migration/alembic_migrations/versions/30dba269cc64_update_order_retry_tasks_table.py +++ /dev/null @@ -1,64 +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. - -"""Update order_retry_tasks table - -Revision ID: 30dba269cc64 -Revises: 3041b53b95d7 -Create Date: 2015-04-01 17:53:25.447919 - -""" - -# revision identifiers, used by Alembic. -revision = '30dba269cc64' -down_revision = '3041b53b95d7' - -from oslo_utils import timeutils - -from alembic import op -from barbican.model import models as m -import sqlalchemy as sa - - -def upgrade(): - op.add_column( - 'order_retry_tasks', - sa.Column( - 'created_at', - sa.DateTime(), - nullable=False, - server_default=str(timeutils.utcnow()))) - op.add_column( - 'order_retry_tasks', - sa.Column( - 'deleted', - sa.Boolean(), - nullable=False, - server_default='0')) - op.add_column( - 'order_retry_tasks', - sa.Column('deleted_at', sa.DateTime(), nullable=True)) - op.add_column( - 'order_retry_tasks', - sa.Column( - 'status', - sa.String(length=20), - nullable=False, - server_default=m.States.PENDING)) - op.add_column( - 'order_retry_tasks', - sa.Column( - 'updated_at', - sa.DateTime(), - nullable=False, - server_default=str(timeutils.utcnow()))) diff --git a/barbican/model/migration/alembic_migrations/versions/39a96e67e990_add_missing_constraints.py b/barbican/model/migration/alembic_migrations/versions/39a96e67e990_add_missing_constraints.py deleted file mode 100644 index 60b7c68ff..000000000 --- a/barbican/model/migration/alembic_migrations/versions/39a96e67e990_add_missing_constraints.py +++ /dev/null @@ -1,47 +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. - -"""Add missing constraints - -Revision ID: 39a96e67e990 -Revises: 4ecde3a3a72a -Create Date: 2016-01-26 13:18:06.113621 - -""" - -# revision identifiers, used by Alembic. -revision = '39a96e67e990' -down_revision = '4ecde3a3a72a' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - # Add missing projects table keystone_id uniqueness constraint. - op.create_unique_constraint('uc_projects_external_ids', - 'projects', ['external_id']) - - # Add missing default for secret_acls' project_access. - op.alter_column('secret_acls', 'project_access', - server_default=sa.sql.expression.true(), - existing_type=sa.Boolean, - existing_server_default=None, - existing_nullable=False) - - # Add missing default for container_acls' project_access. - op.alter_column('container_acls', 'project_access', - server_default=sa.sql.expression.true(), - existing_type=sa.Boolean, - existing_server_default=None, - existing_nullable=False) diff --git a/barbican/model/migration/alembic_migrations/versions/39cf2e645cba_model_for_multiple_backend_support.py b/barbican/model/migration/alembic_migrations/versions/39cf2e645cba_model_for_multiple_backend_support.py deleted file mode 100644 index a42b276a4..000000000 --- a/barbican/model/migration/alembic_migrations/versions/39cf2e645cba_model_for_multiple_backend_support.py +++ /dev/null @@ -1,75 +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. - -"""Model for multiple backend support - -Revision ID: 39cf2e645cba -Revises: d2780d5aa510 -Create Date: 2016-07-29 16:45:22.953811 - -""" - -# revision identifiers, used by Alembic. -revision = '39cf2e645cba' -down_revision = 'd2780d5aa510' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - ctx = op.get_context() - con = op.get_bind() - table_exists = ctx.dialect.has_table(con.engine, 'secret_stores') - if not table_exists: - op.create_table( - 'secret_stores', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('store_plugin', sa.String(length=255), nullable=False), - sa.Column('crypto_plugin', sa.String(length=255), nullable=True), - sa.Column('global_default', sa.Boolean(), nullable=False, - default=False), - sa.Column('name', sa.String(length=255), nullable=False), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('store_plugin', 'crypto_plugin', - name='_secret_stores_plugin_names_uc'), - sa.UniqueConstraint('name', - name='_secret_stores_name_uc') - ) - - table_exists = ctx.dialect.has_table(con.engine, 'project_secret_store') - if not table_exists: - op.create_table( - 'project_secret_store', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('project_id', sa.String(length=36), nullable=False), - sa.Column('secret_store_id', sa.String(length=36), nullable=False), - sa.ForeignKeyConstraint(['project_id'], ['projects.id'],), - sa.ForeignKeyConstraint( - ['secret_store_id'], ['secret_stores.id'],), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('project_id', - name='_project_secret_store_project_uc') - ) - op.create_index(op.f('ix_project_secret_store_project_id'), - 'project_secret_store', ['project_id'], unique=True) diff --git a/barbican/model/migration/alembic_migrations/versions/39cf2e645cba_ocata_rebase.py b/barbican/model/migration/alembic_migrations/versions/39cf2e645cba_ocata_rebase.py new file mode 100644 index 000000000..2bc810502 --- /dev/null +++ b/barbican/model/migration/alembic_migrations/versions/39cf2e645cba_ocata_rebase.py @@ -0,0 +1,530 @@ +# Copyright 2020 OpenStack Foundation +# +# 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. +# + +"""Ocata rebase + +Revision ID: 39cf2e645cba +Revises: None +Create Date: 2020-09-23 07:55:03.238363 + +""" + +# revision identifiers, used by Alembic. +revision = '39cf2e645cba' +down_revision = None + +from alembic import op +import sqlalchemy as sa + +import barbican + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table( + 'projects', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('external_id', sa.String(length=255), nullable=True), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('external_id'), + mysql_engine='InnoDB' + ) + op.create_table( + 'secret_stores', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('store_plugin', sa.String(length=255), nullable=False), + sa.Column('crypto_plugin', sa.String(length=255), nullable=True), + sa.Column('global_default', sa.Boolean(), nullable=False), + sa.Column('name', sa.String(length=255), nullable=False), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('name', name='_secret_stores_name_uc'), + sa.UniqueConstraint('store_plugin', 'crypto_plugin', + name='_secret_stores_plugin_names_uc') + ) + op.create_table( + 'transport_keys', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('plugin_name', sa.String(length=255), nullable=False), + sa.Column('transport_key', sa.Text(), nullable=False), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_table( + 'certificate_authorities', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('plugin_name', sa.String(length=255), nullable=False), + sa.Column('plugin_ca_id', sa.Text(), nullable=False), + sa.Column('expiration', sa.DateTime(), nullable=True), + sa.Column('creator_id', sa.String(length=255), nullable=True), + sa.Column('project_id', sa.String(length=36), nullable=True), + sa.ForeignKeyConstraint(['project_id'], ['projects.id'], + name='cas_project_fk'), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_table( + 'containers', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('name', sa.String(length=255), nullable=True), + sa.Column('type', sa.Enum('generic', 'rsa', 'dsa', 'certificate', + name='container_types'), nullable=True), + sa.Column('project_id', sa.String(length=36), nullable=False), + sa.Column('creator_id', sa.String(length=255), nullable=True), + sa.ForeignKeyConstraint(['project_id'], ['projects.id'], + name='containers_project_fk'), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_containers_project_id'), + 'containers', ['project_id'], unique=False) + op.create_table( + 'kek_data', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('plugin_name', sa.String(length=255), nullable=False), + sa.Column('kek_label', sa.String(length=255), nullable=True), + sa.Column('project_id', sa.String(length=36), nullable=False), + sa.Column('active', sa.Boolean(), nullable=False), + sa.Column('bind_completed', sa.Boolean(), nullable=False), + sa.Column('algorithm', sa.String(length=255), nullable=True), + sa.Column('bit_length', sa.Integer(), nullable=True), + sa.Column('mode', sa.String(length=255), nullable=True), + sa.Column('plugin_meta', sa.Text(), nullable=True), + sa.ForeignKeyConstraint(['project_id'], ['projects.id'], + name='kek_data_project_fk'), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_kek_data_project_id'), + 'kek_data', ['project_id'], unique=False) + op.create_table( + 'project_quotas', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('project_id', sa.String(length=36), nullable=False), + sa.Column('secrets', sa.Integer(), nullable=True), + sa.Column('orders', sa.Integer(), nullable=True), + sa.Column('containers', sa.Integer(), nullable=True), + sa.Column('consumers', sa.Integer(), nullable=True), + sa.Column('cas', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['project_id'], ['projects.id'], + name='project_quotas_fk'), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_project_quotas_project_id'), 'project_quotas', + ['project_id'], unique=False) + op.create_table( + 'project_secret_store', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('secret_store_id', sa.String(length=36), nullable=False), + sa.Column('project_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ), + sa.ForeignKeyConstraint(['secret_store_id'], ['secret_stores.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('project_id', + name='_project_secret_store_project_uc') + ) + op.create_index(op.f('ix_project_secret_store_project_id'), + 'project_secret_store', ['project_id'], unique=False) + op.create_index(op.f('ix_project_secret_store_secret_store_id'), + 'project_secret_store', ['secret_store_id'], + unique=False) + op.create_table( + 'secrets', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('name', sa.String(length=255), nullable=True), + sa.Column('secret_type', sa.String(length=255), + server_default='opaque', nullable=True), + sa.Column('expiration', sa.DateTime(), nullable=True), + sa.Column('algorithm', sa.String(length=255), nullable=True), + sa.Column('bit_length', sa.Integer(), nullable=True), + sa.Column('mode', sa.String(length=255), nullable=True), + sa.Column('creator_id', sa.String(length=255), nullable=True), + sa.Column('project_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['project_id'], ['projects.id'], + name='secrets_project_fk'), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_secrets_project_id'), 'secrets', ['project_id'], + unique=False) + op.create_table( + 'certificate_authority_metadata', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('key', sa.String(length=255), nullable=False), + sa.Column('value', sa.Text(), nullable=False), + sa.Column('ca_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['ca_id'], ['certificate_authorities.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('ca_id', 'key', + name='_certificate_authority_metadatum_uc') + ) + op.create_index(op.f('ix_certificate_authority_metadata_ca_id'), + 'certificate_authority_metadata', ['ca_id'], + unique=False) + op.create_index(op.f('ix_certificate_authority_metadata_key'), + 'certificate_authority_metadata', ['key'], unique=False) + op.create_table( + 'container_acls', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('container_id', sa.String(length=36), nullable=False), + sa.Column('operation', sa.String(length=255), nullable=False), + sa.Column('project_access', sa.Boolean(), nullable=False), + sa.ForeignKeyConstraint(['container_id'], ['containers.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('container_id', 'operation', + name='_container_acl_operation_uc') + ) + op.create_index(op.f('ix_container_acls_container_id'), 'container_acls', + ['container_id'], unique=False) + op.create_table( + 'container_consumer_metadata', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('container_id', sa.String(length=36), nullable=False), + sa.Column('project_id', sa.String(length=36), nullable=True), + sa.Column('name', sa.String(length=36), nullable=True), + sa.Column('URL', sa.String(length=255), nullable=True), + sa.Column('data_hash', sa.CHAR(length=64), nullable=True), + sa.ForeignKeyConstraint(['container_id'], ['containers.id'], ), + sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('data_hash', + name='_consumer_hashed_container_name_url_uc') + ) + op.create_index(op.f('ix_container_consumer_metadata_container_id'), + 'container_consumer_metadata', ['container_id'], + unique=False) + op.create_index(op.f('ix_container_consumer_metadata_project_id'), + 'container_consumer_metadata', ['project_id'], + unique=False) + op.create_index('values_index', 'container_consumer_metadata', + ['container_id', 'name', 'URL'], unique=False) + op.create_table( + 'container_secret', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('name', sa.String(length=255), nullable=True), + sa.Column('container_id', sa.String(length=36), nullable=False), + sa.Column('secret_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['container_id'], ['containers.id'], ), + sa.ForeignKeyConstraint(['secret_id'], ['secrets.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('container_id', 'secret_id', 'name', + name='_container_secret_name_uc') + ) + op.create_index(op.f('ix_container_secret_container_id'), + 'container_secret', ['container_id'], unique=False) + op.create_index(op.f('ix_container_secret_secret_id'), 'container_secret', + ['secret_id'], unique=False) + op.create_table( + 'encrypted_data', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('content_type', sa.String(length=255), nullable=True), + sa.Column('secret_id', sa.String(length=36), nullable=False), + sa.Column('kek_id', sa.String(length=36), nullable=False), + sa.Column('cypher_text', sa.Text(), nullable=True), + sa.Column('kek_meta_extended', sa.Text(), nullable=True), + sa.ForeignKeyConstraint(['kek_id'], ['kek_data.id'], ), + sa.ForeignKeyConstraint(['secret_id'], ['secrets.id'], ), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_encrypted_data_kek_id'), 'encrypted_data', + ['kek_id'], unique=False) + op.create_index(op.f('ix_encrypted_data_secret_id'), 'encrypted_data', + ['secret_id'], unique=False) + op.create_table( + 'orders', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('type', sa.String(length=255), nullable=False), + sa.Column('project_id', sa.String(length=36), nullable=False), + sa.Column('error_status_code', sa.String(length=16), nullable=True), + sa.Column('error_reason', sa.String(length=255), nullable=True), + sa.Column('meta', barbican.model.models.JsonBlob(), nullable=True), + sa.Column('secret_id', sa.String(length=36), nullable=True), + sa.Column('container_id', sa.String(length=36), nullable=True), + sa.Column('sub_status', sa.String(length=36), nullable=True), + sa.Column('sub_status_message', sa.String(length=255), nullable=True), + sa.Column('creator_id', sa.String(length=255), nullable=True), + sa.ForeignKeyConstraint(['container_id'], ['containers.id'], ), + sa.ForeignKeyConstraint(['project_id'], ['projects.id'], + name='orders_project_fk'), + sa.ForeignKeyConstraint(['secret_id'], ['secrets.id'], ), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_orders_container_id'), 'orders', ['container_id'], + unique=False) + op.create_index(op.f('ix_orders_project_id'), 'orders', ['project_id'], + unique=False) + op.create_index(op.f('ix_orders_secret_id'), 'orders', ['secret_id'], + unique=False) + op.create_table( + 'preferred_certificate_authorities', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('project_id', sa.String(length=36), nullable=False), + sa.Column('ca_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['ca_id'], ['certificate_authorities.id'], + name='preferred_certificate_authorities_fk'), + sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_preferred_certificate_authorities_ca_id'), + 'preferred_certificate_authorities', ['ca_id'], + unique=False) + op.create_index(op.f('ix_preferred_certificate_authorities_project_id'), + 'preferred_certificate_authorities', ['project_id'], + unique=True) + op.create_table( + 'project_certificate_authorities', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('project_id', sa.String(length=36), nullable=False), + sa.Column('ca_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['ca_id'], ['certificate_authorities.id'], ), + sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('project_id', 'ca_id', + name='_project_certificate_authority_uc')) + op.create_index(op.f('ix_project_certificate_authorities_ca_id'), + 'project_certificate_authorities', ['ca_id'], + unique=False) + op.create_index(op.f('ix_project_certificate_authorities_project_id'), + 'project_certificate_authorities', ['project_id'], + unique=False) + op.create_table( + 'secret_acls', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('secret_id', sa.String(length=36), nullable=False), + sa.Column('operation', sa.String(length=255), nullable=False), + sa.Column('project_access', sa.Boolean(), nullable=False), + sa.ForeignKeyConstraint(['secret_id'], ['secrets.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('secret_id', 'operation', + name='_secret_acl_operation_uc') + ) + op.create_index(op.f('ix_secret_acls_secret_id'), 'secret_acls', + ['secret_id'], unique=False) + op.create_table( + 'secret_store_metadata', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('key', sa.String(length=255), nullable=False), + sa.Column('value', sa.String(length=255), nullable=False), + sa.Column('secret_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['secret_id'], ['secrets.id'], ), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_secret_store_metadata_secret_id'), + 'secret_store_metadata', ['secret_id'], unique=False) + op.create_table( + 'secret_user_metadata', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('key', sa.String(length=255), nullable=False), + sa.Column('value', sa.String(length=255), nullable=False), + sa.Column('secret_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['secret_id'], ['secrets.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('secret_id', 'key', name='_secret_key_uc') + ) + op.create_index(op.f('ix_secret_user_metadata_secret_id'), + 'secret_user_metadata', ['secret_id'], unique=False) + op.create_table( + 'container_acl_users', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('acl_id', sa.String(length=36), nullable=False), + sa.Column('user_id', sa.String(length=255), nullable=False), + sa.ForeignKeyConstraint(['acl_id'], ['container_acls.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('acl_id', 'user_id', name='_container_acl_user_uc') + ) + op.create_index(op.f('ix_container_acl_users_acl_id'), + 'container_acl_users', ['acl_id'], unique=False) + op.create_table( + 'order_barbican_metadata', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('order_id', sa.String(length=36), nullable=False), + sa.Column('key', sa.String(length=255), nullable=False), + sa.Column('value', sa.Text(), nullable=False), + sa.ForeignKeyConstraint(['order_id'], ['orders.id'], ), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_order_barbican_metadata_order_id'), + 'order_barbican_metadata', ['order_id'], unique=False) + op.create_table( + 'order_plugin_metadata', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('order_id', sa.String(length=36), nullable=False), + sa.Column('key', sa.String(length=255), nullable=False), + sa.Column('value', sa.String(length=255), nullable=False), + sa.ForeignKeyConstraint(['order_id'], ['orders.id'], ), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_order_plugin_metadata_order_id'), + 'order_plugin_metadata', ['order_id'], unique=False) + op.create_table( + 'order_retry_tasks', + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('order_id', sa.String(length=36), nullable=False), + sa.Column('retry_task', sa.Text(), nullable=False), + sa.Column('retry_at', sa.DateTime(), nullable=False), + sa.Column('retry_args', barbican.model.models.JsonBlob(), + nullable=False), + sa.Column('retry_kwargs', barbican.model.models.JsonBlob(), + nullable=False), + sa.Column('retry_count', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['order_id'], ['orders.id'], ), + sa.PrimaryKeyConstraint('id'), + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_order_retry_tasks_order_id'), 'order_retry_tasks', + ['order_id'], unique=False) + op.create_table( + 'secret_acl_users', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('deleted_at', sa.DateTime(), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=False), + sa.Column('status', sa.String(length=20), nullable=False), + sa.Column('acl_id', sa.String(length=36), nullable=False), + sa.Column('user_id', sa.String(length=255), nullable=False), + sa.ForeignKeyConstraint(['acl_id'], ['secret_acls.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('acl_id', 'user_id', name='_secret_acl_user_uc') + ) + op.create_index(op.f('ix_secret_acl_users_acl_id'), 'secret_acl_users', + ['acl_id'], unique=False) + # ### end Alembic commands ### diff --git a/barbican/model/migration/alembic_migrations/versions/3c3b04040bfe_add_owning_project_and_creator_to_cas.py b/barbican/model/migration/alembic_migrations/versions/3c3b04040bfe_add_owning_project_and_creator_to_cas.py deleted file mode 100644 index 4db046ba7..000000000 --- a/barbican/model/migration/alembic_migrations/versions/3c3b04040bfe_add_owning_project_and_creator_to_cas.py +++ /dev/null @@ -1,38 +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. - -"""add owning project and creator to CAs - -Revision ID: 3c3b04040bfe -Revises: 156cd9933643 -Create Date: 2015-09-04 12:22:22.745824 - -""" - -# revision identifiers, used by Alembic. -revision = '3c3b04040bfe' -down_revision = '156cd9933643' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.add_column('certificate_authorities', - sa.Column('creator_id', sa.String(length=255), - nullable=True)) - op.add_column('certificate_authorities', - sa.Column('project_id', sa.String(length=36), - nullable=True)) - op.create_foreign_key('cas_project_fk', 'certificate_authorities', - 'projects', ['project_id'], ['id']) diff --git a/barbican/model/migration/alembic_migrations/versions/3d36a26b88af_add_order_barbican_metadata_table.py b/barbican/model/migration/alembic_migrations/versions/3d36a26b88af_add_order_barbican_metadata_table.py deleted file mode 100644 index 5cadb6909..000000000 --- a/barbican/model/migration/alembic_migrations/versions/3d36a26b88af_add_order_barbican_metadata_table.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. - -"""Add OrderBarbicanMetadata table - -Revision ID: 3d36a26b88af -Revises: 443d6f4a69ac -Create Date: 2015-02-20 12:27:08.155647 - -""" - -# revision identifiers, used by Alembic. -revision = '3d36a26b88af' -down_revision = '443d6f4a69ac' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - ctx = op.get_context() - con = op.get_bind() - table_exists = ctx.dialect.has_table(con.engine, 'order_barbican_metadata') - if not table_exists: - op.create_table( - 'order_barbican_metadata', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('order_id', sa.String(length=36), nullable=False), - sa.Column('key', sa.String(length=255), nullable=False), - sa.Column('value', sa.String(length=255), nullable=False), - sa.ForeignKeyConstraint(['order_id'], ['orders.id'], ), - sa.PrimaryKeyConstraint('id') - ) diff --git a/barbican/model/migration/alembic_migrations/versions/4070806f6972_add_orders_plugin_metadata_table_and_.py b/barbican/model/migration/alembic_migrations/versions/4070806f6972_add_orders_plugin_metadata_table_and_.py deleted file mode 100644 index 20a5447f2..000000000 --- a/barbican/model/migration/alembic_migrations/versions/4070806f6972_add_orders_plugin_metadata_table_and_.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. - -"""Add orders plugin metadata table and relationships - -Revision ID: 4070806f6972 -Revises: 47b69e523451 -Create Date: 2014-08-21 14:06:48.237701 - -""" - -# revision identifiers, used by Alembic. -revision = '4070806f6972' -down_revision = '47b69e523451' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - ctx = op.get_context() - con = op.get_bind() - table_exists = ctx.dialect.has_table(con.engine, 'order_plugin_metadata') - if not table_exists: - op.create_table( - 'order_plugin_metadata', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('order_id', sa.String(length=36), nullable=False), - sa.Column('key', sa.String(length=255), nullable=False), - sa.Column('value', sa.String(length=255), nullable=False), - sa.ForeignKeyConstraint(['order_id'], ['orders.id'],), - sa.PrimaryKeyConstraint('id'), - ) diff --git a/barbican/model/migration/alembic_migrations/versions/443d6f4a69ac_added_secret_type_column_to_secrets_.py b/barbican/model/migration/alembic_migrations/versions/443d6f4a69ac_added_secret_type_column_to_secrets_.py deleted file mode 100644 index 127c5f82b..000000000 --- a/barbican/model/migration/alembic_migrations/versions/443d6f4a69ac_added_secret_type_column_to_secrets_.py +++ /dev/null @@ -1,32 +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. - -"""added secret type column to secrets table - -Revision ID: 443d6f4a69ac -Revises: aa2cf96a1d5 -Create Date: 2015-02-16 12:35:12.876413 - -""" - -# revision identifiers, used by Alembic. -revision = '443d6f4a69ac' -down_revision = 'aa2cf96a1d5' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.add_column('secrets', sa.Column('secret_type', sa.String(length=255), - nullable=False, server_default="opaque")) diff --git a/barbican/model/migration/alembic_migrations/versions/46b98cde536_add_project_quotas_table.py b/barbican/model/migration/alembic_migrations/versions/46b98cde536_add_project_quotas_table.py deleted file mode 100644 index 60c489844..000000000 --- a/barbican/model/migration/alembic_migrations/versions/46b98cde536_add_project_quotas_table.py +++ /dev/null @@ -1,58 +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. - -"""Add project quotas table - -Revision ID: 46b98cde536 -Revises: 1bece815014f -Create Date: 2015-08-28 17:42:35.057103 - -""" - -# revision identifiers, used by Alembic. -revision = '46b98cde536' -down_revision = 'kilo' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - ctx = op.get_context() - con = op.get_bind() - table_exists = ctx.dialect.has_table(con.engine, 'project_quotas') - if not table_exists: - op.create_table( - 'project_quotas', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('project_id', sa.String(length=36), nullable=False), - sa.Column('secrets', sa.Integer(), nullable=True), - sa.Column('orders', sa.Integer(), nullable=True), - sa.Column('containers', sa.Integer(), nullable=True), - sa.Column('transport_keys', sa.Integer(), nullable=True), - sa.Column('consumers', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['project_id'], - ['projects.id'], - name='project_quotas_fk'), - sa.PrimaryKeyConstraint('id'), - mysql_engine='InnoDB') - op.create_index( - op.f('ix_project_quotas_project_id'), - 'project_quotas', - ['project_id'], - unique=False) diff --git a/barbican/model/migration/alembic_migrations/versions/47b69e523451_made_plugin_names_in_kek_datum_non_.py b/barbican/model/migration/alembic_migrations/versions/47b69e523451_made_plugin_names_in_kek_datum_non_.py deleted file mode 100644 index 18ab55891..000000000 --- a/barbican/model/migration/alembic_migrations/versions/47b69e523451_made_plugin_names_in_kek_datum_non_.py +++ /dev/null @@ -1,32 +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. - -"""Made plugin names in kek datum non nullable - -Revision ID: 47b69e523451 -Revises: cd4106a1a0 -Create Date: 2014-06-16 14:05:45.428226 - -""" - -# revision identifiers, used by Alembic. -revision = '47b69e523451' -down_revision = 'cd4106a1a0' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.alter_column('kek_data', 'plugin_name', - type_=sa.String(255), nullable=False) diff --git a/barbican/model/migration/alembic_migrations/versions/4ecde3a3a72a_add_cas_column_to_project_quotas_table.py b/barbican/model/migration/alembic_migrations/versions/4ecde3a3a72a_add_cas_column_to_project_quotas_table.py deleted file mode 100644 index f72ce3382..000000000 --- a/barbican/model/migration/alembic_migrations/versions/4ecde3a3a72a_add_cas_column_to_project_quotas_table.py +++ /dev/null @@ -1,33 +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. - -"""Add cas column to project quotas table - -Revision ID: 4ecde3a3a72a -Revises: 10220ccbe7fa -Create Date: 2015-09-09 09:40:08.540064 - -""" - -# revision identifiers, used by Alembic. -revision = '4ecde3a3a72a' -down_revision = '10220ccbe7fa' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.add_column( - 'project_quotas', - sa.Column('cas', sa.Integer(), nullable=True)) diff --git a/barbican/model/migration/alembic_migrations/versions/6a4457517a3_rename_acl_creator_only_to_project_.py b/barbican/model/migration/alembic_migrations/versions/6a4457517a3_rename_acl_creator_only_to_project_.py deleted file mode 100644 index c16927bd9..000000000 --- a/barbican/model/migration/alembic_migrations/versions/6a4457517a3_rename_acl_creator_only_to_project_.py +++ /dev/null @@ -1,45 +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. - -"""rename ACL creator_only to project_access - -Revision ID: 6a4457517a3 -Revises: 30dba269cc64 -Create Date: 2015-06-03 11:54:55.187875 - -""" - -# revision identifiers, used by Alembic. -revision = '6a4457517a3' -down_revision = '30dba269cc64' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - - op.alter_column('secret_acls', 'creator_only', existing_type=sa.BOOLEAN(), - new_column_name='project_access') - - # reverse existing flag value as project_access is negation of creator_only - op.execute('UPDATE secret_acls SET project_access = NOT project_access', - execution_options={'autocommit': True}) - - op.alter_column('container_acls', 'creator_only', - existing_type=sa.BOOLEAN(), - new_column_name='project_access') - - # reverse existing flag value as project_access is negation of creator_only - op.execute('UPDATE container_acls SET project_access = NOT project_access', - execution_options={'autocommit': True}) diff --git a/barbican/model/migration/alembic_migrations/versions/795737bb3c3_change_tenants_to_projects.py b/barbican/model/migration/alembic_migrations/versions/795737bb3c3_change_tenants_to_projects.py deleted file mode 100644 index 589aa773a..000000000 --- a/barbican/model/migration/alembic_migrations/versions/795737bb3c3_change_tenants_to_projects.py +++ /dev/null @@ -1,95 +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. - -"""Change tenants to projects - -Revision ID: 795737bb3c3 -Revises: 254495565185 -Create Date: 2014-12-09 15:58:35.535032 - -""" - -# revision identifiers, used by Alembic. -revision = '795737bb3c3' -down_revision = '254495565185' - -from alembic import op -import sqlalchemy as sa - - -def _drop_constraint(ctx, con, table, fk_name_to_try): - if ctx.dialect.name == 'mysql': - # MySQL creates different default names for foreign key constraints - op.drop_constraint(fk_name_to_try, - table, - type_='foreignkey') - - -def _change_fk_to_project(ctx, con, table, fk_old, fk_new): - _drop_constraint(ctx, con, table, fk_old) - op.alter_column(table, 'tenant_id', - type_=sa.String(36), - new_column_name='project_id') - op.create_foreign_key(fk_new, table, - 'projects', ['project_id'], ['id']) - - -def upgrade(): - # project_secret table - ctx = op.get_context() - con = op.get_bind() - - # ---- Update tenant_secret table to project_secret: - - _drop_constraint(ctx, con, 'tenant_secret', 'tenant_secret_ibfk_1') - _drop_constraint(ctx, con, 'tenant_secret', 'tenant_secret_ibfk_2') - - op.drop_constraint('_tenant_secret_uc', - 'tenant_secret', - type_='unique') - - op.rename_table('tenant_secret', 'project_secret') - op.alter_column('project_secret', 'tenant_id', - type_=sa.String(36), - new_column_name='project_id') - - op.create_unique_constraint('_project_secret_uc', 'project_secret', - ['project_id', 'secret_id']) - - # ---- Update tenants table to projects: - - op.rename_table('tenants', 'projects') - - # re-create the foreign key constraints with explicit names. - op.create_foreign_key('project_secret_project_fk', 'project_secret', - 'projects', ['project_id'], ['id']) - op.create_foreign_key('project_secret_secret_fk', 'project_secret', - 'secrets', ['secret_id'], ['id']) - - # ---- Update containers table: - - _change_fk_to_project( - ctx, con, 'containers', 'containers_ibfk_1', 'containers_project_fk') - - # ---- Update kek_data table: - - _change_fk_to_project( - ctx, con, 'kek_data', 'kek_data_ibfk_1', 'kek_data_project_fk') - - # ---- Update orders table: - - _change_fk_to_project( - ctx, con, 'orders', 'orders_ibfk_2', 'orders_project_fk') - - op.create_foreign_key('orders_ibfk_2', 'orders', 'containers', - ['container_id'], ['id']) diff --git a/barbican/model/migration/alembic_migrations/versions/aa2cf96a1d5_add_orderretrytask.py b/barbican/model/migration/alembic_migrations/versions/aa2cf96a1d5_add_orderretrytask.py deleted file mode 100644 index 9e5b96664..000000000 --- a/barbican/model/migration/alembic_migrations/versions/aa2cf96a1d5_add_orderretrytask.py +++ /dev/null @@ -1,43 +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. - -"""Add OrderRetryTask - -Revision ID: aa2cf96a1d5 -Revises: 256da65e0c5f -Create Date: 2015-01-19 10:27:19.179196 - -""" - -# revision identifiers, used by Alembic. -revision = "aa2cf96a1d5" -down_revision = "256da65e0c5f" - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.create_table( - "order_retry_tasks", - sa.Column("id", sa.String(length=36), nullable=False), - sa.Column("order_id", sa.String(length=36), nullable=False), - sa.Column("retry_task", sa.Text(), nullable=False), - sa.Column("retry_at", sa.DateTime(), nullable=False), - sa.Column("retry_args", sa.Text(), nullable=False), - sa.Column("retry_kwargs", sa.Text(), nullable=False), - sa.Column("retry_count", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(["order_id"], ["orders.id"]), - sa.PrimaryKeyConstraint("id"), - mysql_engine="InnoDB" - ) diff --git a/barbican/model/migration/alembic_migrations/versions/cd4106a1a0_add_cert_to_container_type.py b/barbican/model/migration/alembic_migrations/versions/cd4106a1a0_add_cert_to_container_type.py deleted file mode 100644 index d2805100d..000000000 --- a/barbican/model/migration/alembic_migrations/versions/cd4106a1a0_add_cert_to_container_type.py +++ /dev/null @@ -1,34 +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. - -"""add-cert-to-container-type - -Revision ID: cd4106a1a0 -Revises: 1e86c18af2dd -Create Date: 2014-06-10 15:07:25.084173 - -""" - -# revision identifiers, used by Alembic. -revision = 'cd4106a1a0' -down_revision = '1e86c18af2dd' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - enum_type = sa.Enum( - 'generic', 'rsa', 'dsa', 'certificate', - name='container_types') - op.alter_column('containers', 'type', type_=enum_type) diff --git a/barbican/model/migration/alembic_migrations/versions/d2780d5aa510_change_url_length.py b/barbican/model/migration/alembic_migrations/versions/d2780d5aa510_change_url_length.py deleted file mode 100644 index 97632b9ed..000000000 --- a/barbican/model/migration/alembic_migrations/versions/d2780d5aa510_change_url_length.py +++ /dev/null @@ -1,35 +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. - -"""change_url_length - -Revision ID: d2780d5aa510 -Revises: dce488646127 -Create Date: 2016-03-11 09:39:32.593231 - -""" - -# revision identifiers, used by Alembic. -revision = 'd2780d5aa510' -down_revision = 'dce488646127' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.alter_column( - 'container_consumer_metadata', - 'URL', - type_=sa.String(length=255) - ) diff --git a/barbican/model/migration/alembic_migrations/versions/dce488646127_add_secret_user_metadata.py b/barbican/model/migration/alembic_migrations/versions/dce488646127_add_secret_user_metadata.py deleted file mode 100644 index f138df60b..000000000 --- a/barbican/model/migration/alembic_migrations/versions/dce488646127_add_secret_user_metadata.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (c) 2015 IBM -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -"""add-secret-user-metadata - -Revision ID: dce488646127 -Revises: 39a96e67e990 -Create Date: 2016-02-09 04:52:03.975486 - -""" - -# revision identifiers, used by Alembic. -revision = 'dce488646127' -down_revision = '39a96e67e990' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - ctx = op.get_context() - con = op.get_bind() - table_exists = ctx.dialect.has_table(con.engine, 'secret_user_metadata') - if not table_exists: - op.create_table( - 'secret_user_metadata', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=False), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('key', sa.String(length=255), nullable=False), - sa.Column('value', sa.String(length=255), nullable=False), - sa.Column('secret_id', sa.String(length=36), nullable=False), - sa.ForeignKeyConstraint(['secret_id'], ['secrets.id'],), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('secret_id', 'key', - name='_secret_key_uc') - ) diff --git a/barbican/model/migration/alembic_migrations/versions/juno_initial.py b/barbican/model/migration/alembic_migrations/versions/juno_initial.py deleted file mode 100644 index 38fd603a6..000000000 --- a/barbican/model/migration/alembic_migrations/versions/juno_initial.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2015 OpenStack Foundation -# -# 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. -# - -"""juno_initial - -Revision ID: juno -Revises: None - -""" - -# revision identifiers, used by Alembic. -revision = 'juno' -down_revision = '1a0c2cdafb38' - - -from barbican.model.migration.alembic_migrations import container_init_ops -from barbican.model.migration.alembic_migrations import encrypted_init_ops -from barbican.model.migration.alembic_migrations import kek_init_ops -from barbican.model.migration.alembic_migrations import order_ops -from barbican.model.migration.alembic_migrations import projects_init_ops -from barbican.model.migration.alembic_migrations import secrets_init_ops -from barbican.model.migration.alembic_migrations import transport_keys_init_ops - - -def upgrade(): - projects_init_ops.upgrade() - secrets_init_ops.upgrade() - container_init_ops.upgrade() - kek_init_ops.upgrade() - encrypted_init_ops.upgrade() - order_ops.upgrade() - transport_keys_init_ops.upgrade() diff --git a/barbican/model/migration/alembic_migrations/versions/kilo_release.py b/barbican/model/migration/alembic_migrations/versions/kilo_release.py deleted file mode 100644 index d3249f6b2..000000000 --- a/barbican/model/migration/alembic_migrations/versions/kilo_release.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2015 OpenStack Foundation -# -# 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. -# - -"""kilo - -Revision ID: kilo -Revises: 1bece815014f -Create Date: 2015-08-26 00:00:00.000000 - -""" - -# revision identifiers, used by Alembic. -revision = 'kilo' -down_revision = '1bece815014f' - - -def upgrade(): - """A no-op migration for marking the Kilo release.""" - pass diff --git a/releasenotes/notes/fixed-mysql-migrations-23221671ba17ea5e.yaml b/releasenotes/notes/fixed-mysql-migrations-23221671ba17ea5e.yaml new file mode 100644 index 000000000..b7d6f6036 --- /dev/null +++ b/releasenotes/notes/fixed-mysql-migrations-23221671ba17ea5e.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fixed Story # 2007732: Migrations broken on MySQL 8.x.