Пример #1
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)
Пример #2
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)
Пример #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)
Пример #4
0
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)
Пример #5
0
def _add_task_info_table():
    op.create_table('task_info',
                    Column('task_id', String(length=36), nullable=False),
                    Column('input', JSONEncodedDict(), nullable=True),
                    Column('result', JSONEncodedDict(), nullable=True),
                    Column('message', Text(), nullable=True),
                    ForeignKeyConstraint(['task_id'], ['tasks.id'], ),
                    PrimaryKeyConstraint('task_id'),
                    mysql_engine='InnoDB',
                    mysql_charset='utf8',
                    extend_existing=True)
Пример #6
0
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)
Пример #7
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)
Пример #8
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)