Merge "Rebase alembic migrations" into stable/ussuri
This commit is contained in:
commit
cc1cc29847
|
@ -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')
|
|
@ -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'),
|
||||
)
|
|
@ -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'])
|
|
@ -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'])
|
|
@ -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
|
|
@ -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))
|
|
@ -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'])
|
|
@ -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')
|
|
@ -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)
|
|
@ -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))
|
|
@ -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')
|
|
@ -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')
|
|
@ -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))
|
|
@ -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']
|
||||
)
|
|
@ -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')
|
||||
)
|
|
@ -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()
|
||||
)
|
|
@ -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())))
|
|
@ -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)
|
|
@ -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)
|
|
@ -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 ###
|
|
@ -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'])
|
|
@ -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')
|
||||
)
|
|
@ -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'),
|
||||
)
|
|
@ -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"))
|
|
@ -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)
|
|
@ -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)
|
|
@ -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))
|
|
@ -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})
|
|
@ -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'])
|
|
@ -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"
|
||||
)
|
|
@ -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)
|
|
@ -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)
|
||||
)
|
|
@ -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')
|
||||
)
|
|
@ -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()
|
|
@ -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
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixed Story # 2007732: Migrations broken on MySQL 8.x.
|
Loading…
Reference in New Issue