Exemplo n.º 1
0
class Endpoint(base.BASE, base.IdMixin):
    __tablename__ = 'endpoints'

    node_id = sa.Column(types.UUID(),
                        sa.ForeignKey('nodes.id'),
                        primary_key=True)
    uri = sa.Column(sa.String(255), nullable=False)
    type = sa.Column(sa.String(length=255), nullable=False)
    deleted = sa.Column(sa.Boolean(), default=False, nullable=False)
    sa.Index("endpoints_id_idx", "id", unique=True)
    sa.Index("endpoints_nodes_id_idx", "node_id", unique=False)
Exemplo n.º 2
0
class BrokerMetadata(base.BASE, base.IdMixin, models.TimestampMixin,
                     base.SoftDeleteMixin):
    __tablename__ = 'broker_metadata'

    broker_id = sa.Column('broker_id',
                          types.UUID(),
                          sa.ForeignKey('broker.id'),
                          nullable=False)
    key = sa.Column(sa.String(255), nullable=False)
    value = sa.Column(sa.String(255), nullable=False)
    sa.Index("brokerMetadata_id_idx", "id", unique=True)
    sa.Index("brokerMetadata_broker_id_idx", "broker_id", unique=False)
Exemplo n.º 3
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('clusters',
    sa.Column('id', types.UUID(), nullable=False),
    sa.Column('project_id', sa.String(length=36), nullable=False),
    sa.Column('network_id', sa.String(length=36), nullable=False),
    sa.Column('name', sa.String(length=255), nullable=False),
    sa.Column('status', sa.String(length=50), nullable=False),
    sa.Column('flavor', sa.String(length=50), nullable=False),
    sa.Column('size', sa.Integer(), nullable=False),
    sa.Column('volume_size', sa.Integer(), nullable=True),
    sa.Column('deleted', sa.Boolean(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('deleted_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('nodes',
    sa.Column('id', types.UUID(), nullable=False),
    sa.Column('cluster_id', types.UUID(), nullable=True),
    sa.Column('flavor', sa.String(length=36), nullable=False),
    sa.Column('instance_id', sa.String(length=36), nullable=True),
    sa.Column('status', sa.String(length=50), nullable=False),
    sa.Column('deleted', sa.Boolean(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('deleted_at', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['cluster_id'], ['clusters.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('endpoints',
    sa.Column('id', types.UUID(), nullable=False),
    sa.Column('node_id', types.UUID(), nullable=False),
    sa.Column('type', sa.String(length=255), nullable=False),
    sa.Column('uri', sa.String(length=255), nullable=False),
    sa.Column('deleted', sa.Boolean(), nullable=False),
    sa.ForeignKeyConstraint(['node_id'], ['nodes.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
Exemplo n.º 4
0
class Cluster(base.BASE, base.IdMixin, models.TimestampMixin,
              base.SoftDeleteMixin):
    __tablename__ = 'clusters'

    project_id = sa.Column(sa.String(36), nullable=False)
    network_id = sa.Column(sa.String(36), nullable=False)
    name = sa.Column(sa.String(255), nullable=False)
    status = sa.Column(sa.String(50), nullable=False)
    flavor = sa.Column(sa.String(50), nullable=False)
    size = sa.Column(sa.Integer(), default=1, nullable=False)
    volume_size = sa.Column(sa.Integer(), nullable=True)
    error_detail = sa.Column(sa.Text(), nullable=True)
    group_id = sa.Column(types.UUID(), nullable=True)
    sa.Index("clusters_cluster_id_idx", "cluster_id", unique=True)
Exemplo n.º 5
0
class Node(base.BASE, base.IdMixin, models.TimestampMixin,
           base.SoftDeleteMixin):
    __tablename__ = 'nodes'

    cluster_id = sa.Column('cluster_id',
                           types.UUID(),
                           sa.ForeignKey('clusters.id'),
                           nullable=False)
    flavor = sa.Column(sa.String(36), nullable=False)
    instance_id = sa.Column(sa.String(36), nullable=True)
    status = sa.Column(sa.String(50), nullable=False)
    management_ip = sa.Column(sa.String(45), nullable=True)
    sa.Index("nodes_id_idx", "id", unique=True)
    sa.Index("nodes_cluster_id_idx", "cluster_id", unique=False)
Exemplo n.º 6
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('broker', sa.Column('id', types.UUID(), nullable=False),
                    sa.Column('name', sa.String(length=255), nullable=False),
                    sa.Column('active', sa.Boolean(), nullable=False),
                    sa.Column('deleted', sa.Boolean(), nullable=False),
                    sa.Column('created_at', sa.DateTime(), nullable=False),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('deleted_at', sa.DateTime(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table('broker_metadata',
                    sa.Column('id', types.UUID(), nullable=False),
                    sa.Column('broker_id', types.UUID(), nullable=False),
                    sa.Column('key', sa.String(length=255), nullable=False),
                    sa.Column('value', sa.String(length=255), nullable=False),
                    sa.Column('deleted', sa.Boolean(), nullable=False),
                    sa.Column('created_at', sa.DateTime(), nullable=False),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('deleted_at', sa.DateTime(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['broker_id'],
                        ['broker.id'],
                    ), sa.PrimaryKeyConstraint('id'))
Exemplo n.º 7
0
class IdMixin(object):
    """Id mixin, add to subclasses that have a tenant."""
    id = sa.Column(types.UUID(),
                   nullable=False,
                   default=lambda i: str(uuid.uuid4()),
                   primary_key=True)
def upgrade():
    op.add_column('clusters',
                  sa.Column('error_detail', sa.Text(), nullable=True))
    op.add_column('clusters', sa.Column('group_id',
                                        types.UUID(),
                                        nullable=True))