Пример #1
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)
Пример #2
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)
Пример #3
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)
Пример #4
0
class MetadefProperty(BASE_DICT, GlanceMetadefBase):
    """Represents a metadata-schema namespace-property in the datastore."""
    __tablename__ = 'metadef_properties'
    __table_args__ = (Index('ix_metadef_properties_namespace_id',
                            'namespace_id'),
                      Index('ix_metadef_properties_name', 'name'))

    id = Column(Integer, primary_key=True, nullable=False)
    namespace_id = Column(Integer(),
                          ForeignKey('metadef_namespaces.id'),
                          nullable=False)
    name = Column(String(80), nullable=False)
    json_schema = Column(JSONEncodedDict(), default={})
Пример #5
0
class MetadefObject(BASE_DICT, GlanceMetadefBase):
    """Represents a metadata-schema object in the datastore."""
    __tablename__ = 'metadef_objects'
    __table_args__ = (Index('ix_metadef_objects_namespace_id', 'namespace_id'),
                      Index('ix_metadef_objects_name', 'name'))

    id = Column(Integer, primary_key=True, nullable=False)
    namespace_id = Column(Integer(),
                          ForeignKey('metadef_namespaces.id'),
                          nullable=False)
    name = Column(String(80), nullable=False)
    description = Column(Text())
    required = Column(Text())
    json_schema = Column(JSONEncodedDict(), default={})