Make alembic used in barbican similar to other openstack projects
Adding initial script for alembic. Change-Id: If3b898071c16efa431857b54f62af671c46b56bb Implements: blueprint add-missing-alembic-modules Closes-bug: #1423962
This commit is contained in:
parent
b95ecb7f58
commit
15643df0b6
89
barbican/model/migration/alembic_migrations/ca_init_ops.py
Normal file
89
barbican/model/migration/alembic_migrations/ca_init_ops.py
Normal file
@ -0,0 +1,89 @@
|
||||
# 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')
|
||||
)
|
@ -0,0 +1,115 @@
|
||||
# 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(
|
||||
'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('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.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),
|
||||
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('URL', sa.String(length=500), nullable=True),
|
||||
sa.Column('data_hash', sa.CHAR(64), nullable=True),
|
||||
sa.ForeignKeyConstraint(['container_id'], ['containers.id'],),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('data_hash',
|
||||
name='_consumer_hashed_container_name_url_uc'),
|
||||
sa.Index('values_index', 'container_id', 'name', 'URL')
|
||||
)
|
||||
|
||||
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')
|
||||
)
|
@ -0,0 +1,42 @@
|
||||
# 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(
|
||||
'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(['secret_id'], ['secrets.id'],),
|
||||
sa.ForeignKeyConstraint(['kek_id'], ['kek_data.id'],),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
45
barbican/model/migration/alembic_migrations/kek_init_ops.py
Normal file
45
barbican/model/migration/alembic_migrations/kek_init_ops.py
Normal file
@ -0,0 +1,45 @@
|
||||
# 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(
|
||||
'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_lable', 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'],),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
97
barbican/model/migration/alembic_migrations/order_ops.py
Normal file
97
barbican/model/migration/alembic_migrations/order_ops.py
Normal file
@ -0,0 +1,97 @@
|
||||
# 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(
|
||||
'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', 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.ForeignKeyConstraint(['secret_id'], ['secrets.id'], ),
|
||||
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ),
|
||||
sa.ForeignKeyConstraint(['container_id'], ['containers.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"
|
||||
)
|
@ -0,0 +1,36 @@
|
||||
# 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(
|
||||
'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')
|
||||
)
|
@ -0,0 +1,97 @@
|
||||
# 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,37 @@
|
||||
# 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(
|
||||
'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=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
@ -16,14 +16,14 @@
|
||||
"""create_secret_store_metadata_table
|
||||
|
||||
Revision ID: 13d127569afa
|
||||
Revises: 1a0c2cdafb38
|
||||
Revises: juno
|
||||
Create Date: 2014-04-24 13:15:41.858266
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '13d127569afa'
|
||||
down_revision = '1a0c2cdafb38'
|
||||
down_revision = 'juno'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""create test table
|
||||
|
||||
Revision ID: 1a0c2cdafb38
|
||||
Revises: None
|
||||
Revises: juno
|
||||
Create Date: 2013-06-17 16:42:13.634746
|
||||
|
||||
"""
|
||||
|
@ -8,7 +8,7 @@ Create Date: 2015-08-28 17:42:35.057103
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '46b98cde536'
|
||||
down_revision = '1bece815014f'
|
||||
down_revision = 'kilo'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
@ -0,0 +1,46 @@
|
||||
# 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 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 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()
|
||||
transport_keys_init_ops.upgrade()
|
@ -0,0 +1,31 @@
|
||||
# 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
|
Loading…
Reference in New Issue
Block a user