Exemple #1
0
def _add_image_locations_table():
    op.create_table('image_locations',
                    Column('id', Integer(), nullable=False),
                    Column('image_id', String(length=36), nullable=False),
                    Column('value', Text(), nullable=False),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=True),
                    Column('deleted_at', DateTime(), nullable=True),
                    Column('deleted', Boolean(), nullable=False),
                    Column('meta_data', JSONEncodedDict(), nullable=True),
                    Column('status',
                           String(length=30),
                           server_default='active',
                           nullable=False),
                    PrimaryKeyConstraint('id'),
                    ForeignKeyConstraint(
                        ['image_id'],
                        ['images.id'],
                    ),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_image_locations_deleted',
                    'image_locations', ['deleted'],
                    unique=False)
    op.create_index('ix_image_locations_image_id',
                    'image_locations', ['image_id'],
                    unique=False)
Exemple #2
0
def _add_images_table():
    op.create_table('images',
                    Column('id', String(length=36), nullable=False),
                    Column('name', String(length=255), nullable=True),
                    Column('size', BigInteger(), nullable=True),
                    Column('status', String(length=30), nullable=False),
                    Column('is_public', Boolean(), nullable=False),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=True),
                    Column('deleted_at', DateTime(), nullable=True),
                    Column('deleted', Boolean(), nullable=False),
                    Column('disk_format', String(length=20), nullable=True),
                    Column('container_format',
                           String(length=20),
                           nullable=True),
                    Column('checksum', String(length=32), nullable=True),
                    Column('owner', String(length=255), nullable=True),
                    Column('min_disk', Integer(), nullable=False),
                    Column('min_ram', Integer(), nullable=False),
                    Column('protected',
                           Boolean(),
                           server_default=sql.false(),
                           nullable=False),
                    Column('virtual_size', BigInteger(), nullable=True),
                    PrimaryKeyConstraint('id'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('checksum_image_idx', 'images', ['checksum'], unique=False)
    op.create_index('ix_images_deleted', 'images', ['deleted'], unique=False)
    op.create_index('ix_images_is_public',
                    'images', ['is_public'],
                    unique=False)
    op.create_index('owner_image_idx', 'images', ['owner'], unique=False)
Exemple #3
0
def _add_image_properties_table():
    op.create_table('image_properties',
                    Column('id', Integer(), nullable=False),
                    Column('image_id', String(length=36), nullable=False),
                    Column('name', String(length=255), nullable=False),
                    Column('value', Text(), nullable=True),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=True),
                    Column('deleted_at', DateTime(), nullable=True),
                    Column('deleted', Boolean(), nullable=False),
                    PrimaryKeyConstraint('id'),
                    ForeignKeyConstraint(
                        ['image_id'],
                        ['images.id'],
                    ),
                    UniqueConstraint('image_id',
                                     'name',
                                     name='ix_image_properties_image_id_name'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_image_properties_deleted',
                    'image_properties', ['deleted'],
                    unique=False)
    op.create_index('ix_image_properties_image_id',
                    'image_properties', ['image_id'],
                    unique=False)
Exemple #4
0
def _add_metadef_objects_table():
    ns_id_name_constraint = 'uq_metadef_objects_namespace_id_name'

    op.create_table('metadef_objects',
                    Column('id', Integer(), nullable=False),
                    Column('namespace_id', Integer(), nullable=False),
                    Column('name', String(length=80), nullable=False),
                    Column('description', Text(), nullable=True),
                    Column('required', Text(), nullable=True),
                    Column('json_schema', JSONEncodedDict(), nullable=False),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=True),
                    ForeignKeyConstraint(['namespace_id'],
                                         ['metadef_namespaces.id'], ),
                    PrimaryKeyConstraint('id'),
                    UniqueConstraint('namespace_id',
                                     'name',
                                     name=ns_id_name_constraint),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_metadef_objects_name',
                    'metadef_objects',
                    ['name'],
                    unique=False)
def _add_artifact_blobs_table():
    op.create_table('artifact_blobs',
                    Column('id', String(length=36), nullable=False),
                    Column('artifact_id', String(length=36), nullable=False),
                    Column('size', BigInteger(), nullable=False),
                    Column('checksum', String(length=32), nullable=True),
                    Column('name', String(length=255), nullable=False),
                    Column('item_key', String(length=329), nullable=True),
                    Column('position', Integer(), nullable=True),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=False),
                    ForeignKeyConstraint(
                        ['artifact_id'],
                        ['artifacts.id'],
                    ),
                    PrimaryKeyConstraint('id'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_artifact_blobs_artifact_id',
                    'artifact_blobs', ['artifact_id'],
                    unique=False)
    op.create_index('ix_artifact_blobs_name',
                    'artifact_blobs', ['name'],
                    unique=False)
def _add_artifact_properties_table():
    op.create_table('artifact_properties',
                    Column('id', String(length=36), nullable=False),
                    Column('artifact_id', String(length=36), nullable=False),
                    Column('name', String(length=255), nullable=False),
                    Column('string_value', String(length=255), nullable=True),
                    Column('int_value', Integer(), nullable=True),
                    Column('numeric_value', Numeric(), nullable=True),
                    Column('bool_value', Boolean(), nullable=True),
                    Column('text_value', Text(), nullable=True),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=False),
                    Column('position', Integer(), nullable=True),
                    ForeignKeyConstraint(
                        ['artifact_id'],
                        ['artifacts.id'],
                    ),
                    PrimaryKeyConstraint('id'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_artifact_properties_artifact_id',
                    'artifact_properties', ['artifact_id'],
                    unique=False)
    op.create_index('ix_artifact_properties_name',
                    'artifact_properties', ['name'],
                    unique=False)
Exemple #7
0
def _add_metadef_resource_types_table():
    op.create_table('metadef_resource_types',
                    Column('id', Integer(), nullable=False),
                    Column('name', String(length=80), nullable=False),
                    Column('protected', Boolean(), nullable=False),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=True),
                    PrimaryKeyConstraint('id'),
                    UniqueConstraint('name',
                                     name='uq_metadef_resource_types_name'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)
def _add_artifact_dependencies_table():
    op.create_table('artifact_dependencies',
                    Column('id', String(length=36), nullable=False),
                    Column('artifact_source',
                           String(length=36),
                           nullable=False),
                    Column('artifact_dest', String(length=36), nullable=False),
                    Column('artifact_origin',
                           String(length=36),
                           nullable=False),
                    Column('is_direct', Boolean(), nullable=False),
                    Column('position', Integer(), nullable=True),
                    Column('name', String(length=36), nullable=True),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=False),
                    ForeignKeyConstraint(
                        ['artifact_dest'],
                        ['artifacts.id'],
                    ),
                    ForeignKeyConstraint(
                        ['artifact_origin'],
                        ['artifacts.id'],
                    ),
                    ForeignKeyConstraint(
                        ['artifact_source'],
                        ['artifacts.id'],
                    ),
                    PrimaryKeyConstraint('id'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_artifact_dependencies_dest_id',
                    'artifact_dependencies', ['artifact_dest'],
                    unique=False)
    op.create_index('ix_artifact_dependencies_direct_dependencies',
                    'artifact_dependencies', ['artifact_source', 'is_direct'],
                    unique=False)
    op.create_index('ix_artifact_dependencies_origin_id',
                    'artifact_dependencies', ['artifact_origin'],
                    unique=False)
    op.create_index('ix_artifact_dependencies_source_id',
                    'artifact_dependencies', ['artifact_source'],
                    unique=False)
def _add_artifacts_table():
    op.create_table('artifacts',
                    Column('id', String(length=36), nullable=False),
                    Column('name', String(length=255), nullable=False),
                    Column('type_name', String(length=255), nullable=False),
                    Column('type_version_prefix', BigInteger(),
                           nullable=False),
                    Column('type_version_suffix',
                           String(length=255),
                           nullable=True),
                    Column('type_version_meta',
                           String(length=255),
                           nullable=True),
                    Column('version_prefix', BigInteger(), nullable=False),
                    Column('version_suffix', String(length=255),
                           nullable=True),
                    Column('version_meta', String(length=255), nullable=True),
                    Column('description', Text(), nullable=True),
                    Column('visibility', String(length=32), nullable=False),
                    Column('state', String(length=32), nullable=False),
                    Column('owner', String(length=255), nullable=False),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=False),
                    Column('deleted_at', DateTime(), nullable=True),
                    Column('published_at', DateTime(), nullable=True),
                    PrimaryKeyConstraint('id'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_artifact_name_and_version',
                    'artifacts', ['name', 'version_prefix', 'version_suffix'],
                    unique=False)
    op.create_index('ix_artifact_owner', 'artifacts', ['owner'], unique=False)
    op.create_index('ix_artifact_state', 'artifacts', ['state'], unique=False)
    op.create_index(
        'ix_artifact_type',
        'artifacts',
        ['type_name', 'type_version_prefix', 'type_version_suffix'],
        unique=False)
    op.create_index('ix_artifact_visibility',
                    'artifacts', ['visibility'],
                    unique=False)
Exemple #10
0
def _add_metadef_tags_table():
    op.create_table('metadef_tags',
                    Column('id', Integer(), nullable=False),
                    Column('namespace_id', Integer(), nullable=False),
                    Column('name', String(length=80), nullable=False),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=True),
                    ForeignKeyConstraint(['namespace_id'],
                                         ['metadef_namespaces.id'], ),
                    PrimaryKeyConstraint('id'),
                    UniqueConstraint('namespace_id',
                                     'name',
                                     name='uq_metadef_tags_namespace_id_name'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_metadef_tags_name',
                    'metadef_tags',
                    ['name'],
                    unique=False)
Exemple #11
0
def _add_artifact_blob_locations_table():
    op.create_table('artifact_blob_locations',
                    Column('id', String(length=36), nullable=False),
                    Column('blob_id', String(length=36), nullable=False),
                    Column('value', Text(), nullable=False),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=False),
                    Column('position', Integer(), nullable=True),
                    Column('status', String(length=36), nullable=True),
                    ForeignKeyConstraint(
                        ['blob_id'],
                        ['artifact_blobs.id'],
                    ),
                    PrimaryKeyConstraint('id'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_artifact_blob_locations_blob_id',
                    'artifact_blob_locations', ['blob_id'],
                    unique=False)
Exemple #12
0
def _add_metadef_namespaces_table():
    op.create_table('metadef_namespaces',
                    Column('id', Integer(), nullable=False),
                    Column('namespace', String(length=80), nullable=False),
                    Column('display_name', String(length=80), nullable=True),
                    Column('description', Text(), nullable=True),
                    Column('visibility', String(length=32), nullable=True),
                    Column('protected', Boolean(), nullable=True),
                    Column('owner', String(length=255), nullable=False),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=True),
                    PrimaryKeyConstraint('id'),
                    UniqueConstraint('namespace',
                                     name='uq_metadef_namespaces_namespace'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_metadef_namespaces_owner',
                    'metadef_namespaces',
                    ['owner'],
                    unique=False)
Exemple #13
0
def _add_artifact_tags_table():
    op.create_table('artifact_tags',
                    Column('id', String(length=36), nullable=False),
                    Column('artifact_id', String(length=36), nullable=False),
                    Column('value', String(length=255), nullable=False),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=False),
                    ForeignKeyConstraint(
                        ['artifact_id'],
                        ['artifacts.id'],
                    ),
                    PrimaryKeyConstraint('id'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_artifact_tags_artifact_id',
                    'artifact_tags', ['artifact_id'],
                    unique=False)
    op.create_index('ix_artifact_tags_artifact_id_tag_value',
                    'artifact_tags', ['artifact_id', 'value'],
                    unique=False)
Exemple #14
0
def _add_metadef_namespace_resource_types_table():
    op.create_table('metadef_namespace_resource_types',
                    Column('resource_type_id', Integer(), nullable=False),
                    Column('namespace_id', Integer(), nullable=False),
                    Column('properties_target',
                           String(length=80),
                           nullable=True),
                    Column('prefix', String(length=80), nullable=True),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=True),
                    ForeignKeyConstraint(['namespace_id'],
                                         ['metadef_namespaces.id'], ),
                    ForeignKeyConstraint(['resource_type_id'],
                                         ['metadef_resource_types.id'], ),
                    PrimaryKeyConstraint('resource_type_id', 'namespace_id'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_metadef_ns_res_types_namespace_id',
                    'metadef_namespace_resource_types',
                    ['namespace_id'],
                    unique=False)
Exemple #15
0
def _add_image_members_table():
    deleted_member_constraint = 'image_members_image_id_member_deleted_at_key'
    op.create_table('image_members',
                    Column('id', Integer(), nullable=False),
                    Column('image_id', String(length=36), nullable=False),
                    Column('member', String(length=255), nullable=False),
                    Column('can_share', Boolean(), nullable=False),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=True),
                    Column('deleted_at', DateTime(), nullable=True),
                    Column('deleted', Boolean(), nullable=False),
                    Column('status',
                           String(length=20),
                           server_default='pending',
                           nullable=False),
                    ForeignKeyConstraint(
                        ['image_id'],
                        ['images.id'],
                    ),
                    PrimaryKeyConstraint('id'),
                    UniqueConstraint('image_id',
                                     'member',
                                     'deleted_at',
                                     name=deleted_member_constraint),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_image_members_deleted',
                    'image_members', ['deleted'],
                    unique=False)
    op.create_index('ix_image_members_image_id',
                    'image_members', ['image_id'],
                    unique=False)
    op.create_index('ix_image_members_image_id_member',
                    'image_members', ['image_id', 'member'],
                    unique=False)
Exemple #16
0
def _add_tasks_table():
    op.create_table('tasks',
                    Column('id', String(length=36), nullable=False),
                    Column('type', String(length=30), nullable=False),
                    Column('status', String(length=30), nullable=False),
                    Column('owner', String(length=255), nullable=False),
                    Column('expires_at', DateTime(), nullable=True),
                    Column('created_at', DateTime(), nullable=False),
                    Column('updated_at', DateTime(), nullable=True),
                    Column('deleted_at', DateTime(), nullable=True),
                    Column('deleted', Boolean(), nullable=False),
                    PrimaryKeyConstraint('id'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)

    op.create_index('ix_tasks_deleted', 'tasks', ['deleted'], unique=False)
    op.create_index('ix_tasks_owner', 'tasks', ['owner'], unique=False)
    op.create_index('ix_tasks_status', 'tasks', ['status'], unique=False)
    op.create_index('ix_tasks_type', 'tasks', ['type'], unique=False)
    op.create_index('ix_tasks_updated_at',
                    'tasks',
                    ['updated_at'],
                    unique=False)