Ensure Alembic version modules bootstrap new db
The current Alembic version modules (including the initial juno one) were not able to bring a database up from a new/fresh state (at least for Postgresql). This CR adjusts the version files to support this, including replacing some dialect-busting op.execute(...) calls with generic op calls. Change-Id: Idf1fffb1a55203a5db47ea28bab2502db69a977e Closes-bug: #1499396
This commit is contained in:
parent
f2a21fa804
commit
4ae5156fab
@ -1,89 +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.
|
||||
#
|
||||
|
||||
# Initial operations for agent management extension
|
||||
# This module only manages the 'agents' table. Binding tables are created
|
||||
# in the modules for relevant resources
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
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')
|
||||
)
|
||||
|
||||
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')
|
||||
)
|
||||
|
||||
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')
|
||||
)
|
||||
|
||||
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')
|
||||
)
|
@ -34,49 +34,11 @@ def upgrade():
|
||||
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('creator_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('project_id', sa.String(length=36), nullable=False),
|
||||
sa.ForeignKeyConstraint(['project_id'], ['projects.id'],),
|
||||
sa.Column('tenant_id', sa.String(length=36), nullable=False),
|
||||
sa.ForeignKeyConstraint(['tenant_id'], ['tenants.id'],),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
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(
|
||||
'container_consumer_metadata',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
@ -98,18 +60,11 @@ def upgrade():
|
||||
|
||||
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')
|
||||
)
|
||||
|
@ -32,14 +32,14 @@ def upgrade():
|
||||
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_lable', sa.String(length=255), nullable=True),
|
||||
sa.Column('project_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('kek_label', sa.String(length=255), nullable=True),
|
||||
sa.Column('tenant_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'],),
|
||||
sa.ForeignKeyConstraint(['tenant_id'], ['tenants.id'],),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
@ -31,67 +31,18 @@ def upgrade():
|
||||
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', sa.Text(), 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.Column('secret_mode', sa.String(length=255), nullable=True),
|
||||
sa.Column('secret_algorithm', sa.String(length=255), nullable=True),
|
||||
sa.Column('secret_bit_length', sa.String(length=255), nullable=True),
|
||||
sa.Column('secret_expiration', sa.String(length=255), nullable=True),
|
||||
sa.Column('secret_payload_content_type', sa.String(length=255),
|
||||
nullable=True),
|
||||
sa.Column('secret_name', sa.String(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(['secret_id'], ['secrets.id'], ),
|
||||
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ),
|
||||
sa.ForeignKeyConstraint(['container_id'], ['containers.id'], ),
|
||||
sa.ForeignKeyConstraint(['tenant_id'], ['tenants.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
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')
|
||||
)
|
||||
|
||||
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'),
|
||||
)
|
||||
|
||||
op.create_table(
|
||||
"order_retry_tasks",
|
||||
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("order_id", sa.String(length=36), nullable=False),
|
||||
sa.Column('status', sa.String(length=20), 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"
|
||||
)
|
||||
|
@ -24,13 +24,13 @@ import sqlalchemy as sa
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'projects',
|
||||
'tenants',
|
||||
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.Column('keystone_id', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
@ -1,97 +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.
|
||||
#
|
||||
|
||||
# Initial operations for agent management extension
|
||||
# This module only manages the 'agents' table. Binding tables are created
|
||||
# in the modules for relevant resources
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
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), 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'],
|
||||
'secrets_project_fk'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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')
|
||||
)
|
@ -0,0 +1,50 @@
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Initial operations for agent management extension
|
||||
# This module only manages the 'agents' table. Binding tables are created
|
||||
# in the modules for relevant resources
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
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('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.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
op.create_table(
|
||||
'tenant_secret',
|
||||
sa.Column('tenant_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('secret_id', sa.String(length=36), nullable=False),
|
||||
sa.ForeignKeyConstraint(['tenant_id'], ['tenants.id'],),
|
||||
sa.ForeignKeyConstraint(['secret_id'], ['secrets.id'],),
|
||||
sa.UniqueConstraint('tenant_id', 'secret_id',
|
||||
name='_tenant_secret_uc')
|
||||
)
|
@ -15,13 +15,16 @@ import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
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.execute( 'ALTER TABLE container_secret DROP PRIMARY KEY, ADD PRIMARY KEY(`id`,`container_id`,`secret_id`)');
|
||||
op.execute( 'ALTER TABLE containers CHANGE type type ENUM(\'generic\',\'rsa\',\'dsa\',\'certificate\') DEFAULT NULL');
|
||||
### end Alembic commands ###
|
||||
|
||||
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']
|
||||
)
|
||||
|
@ -15,6 +15,7 @@ import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.execute( 'ALTER TABLE containers CHANGE type type ENUM(\'generic\',\'rsa\',\'certificate\') DEFAULT NULL');
|
||||
### end Alembic commands ###
|
||||
enum_type = sa.Enum(
|
||||
'generic', 'rsa', 'dsa', 'certificate',
|
||||
name='container_types')
|
||||
op.alter_column('containers', 'type', type_=enum_type)
|
||||
|
@ -25,22 +25,20 @@ revision = 'juno'
|
||||
down_revision = '1a0c2cdafb38'
|
||||
|
||||
|
||||
from barbican.model.migration.alembic_migrations import ca_init_ops
|
||||
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 secretes_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():
|
||||
ca_init_ops.upgrade()
|
||||
container_init_ops.upgrade()
|
||||
encrypted_init_ops.upgrade()
|
||||
kek_init_ops.upgrade()
|
||||
order_ops.upgrade()
|
||||
projects_init_ops.upgrade()
|
||||
secretes_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()
|
||||
|
Loading…
Reference in New Issue
Block a user