class ReorgLog(BaseModel):
    __tablename__ = 'data_reorg_log'

    block_hash = sa.Column(sa.String(66), primary_key=True, index=True, nullable=False)
    block_id = sa.Column(sa.Integer(), autoincrement=False)
    log_idx = sa.Column(sa.Integer(), primary_key=True, autoincrement=False)
    type_id = sa.Column(sa.Integer(), index=True)
    type = sa.Column(sa.String(64))
    data = sa.Column(sa.JSON())

    def serialize_id(self):
        return '{}-{}'.format(self.block_id, self.log_idx)
示例#2
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_unique_constraint(None, 'cash_withdrawal', ['id'])
    op.create_unique_constraint(None, 'computer', ['id'])
    op.create_unique_constraint(None, 'license', ['id'])
    op.add_column('product', sa.Column('release', sa.JSON(), nullable=False))
    op.create_unique_constraint(None, 'product', ['id'])
    op.drop_column('product', 'period')
    op.create_unique_constraint(None, 'promo_code', ['id'])
    op.create_unique_constraint(None, 'purchase', ['id'])
    op.create_unique_constraint(None, 'role', ['id'])
    op.create_unique_constraint(None, 'user_', ['id'])
示例#3
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('reddit_users',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(), nullable=True),
                    sa.Column('karma', sa.Integer(), nullable=True),
                    sa.Column('age', sa.TIMESTAMP(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table('results', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('hash', sa.String(), nullable=True),
                    sa.Column('eligible', sa.JSON(), nullable=True),
                    sa.Column('winners', sa.JSON(), nullable=True),
                    sa.Column('violators', sa.JSON(), nullable=True),
                    sa.Column('not_entering', sa.JSON(), nullable=True),
                    sa.Column('thread', sa.String(), nullable=True),
                    sa.Column('title', sa.String(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'reddit_comments', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('thread', sa.String(), nullable=True),
        sa.Column('author_id', sa.Integer(), nullable=False),
        sa.Column('comment_id', sa.String(), nullable=True),
        sa.Column('body', sa.String(), nullable=True),
        sa.Column('entering', sa.Boolean(), nullable=True),
        sa.ForeignKeyConstraint(
            ['author_id'],
            ['reddit_users.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'steam_users', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('reddit_comment_id', sa.Integer(), nullable=False),
        sa.Column('steam_id', sa.String(), nullable=True),
        sa.Column('level', sa.Integer(), nullable=True),
        sa.Column('public_profile', sa.Boolean(), nullable=True),
        sa.Column('existent', sa.Boolean(), nullable=True),
        sa.Column('games_visible', sa.Boolean(), nullable=True),
        sa.Column('games_count', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['reddit_comment_id'], ['reddit_comments.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'))
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=20), nullable=False),
    sa.Column('email', sa.String(length=120), nullable=False),
    sa.Column('image_file', sa.String(length=20), nullable=False),
    sa.Column('password', sa.String(length=60), nullable=False),
    sa.Column('strava_id', sa.Integer(), nullable=True),
    sa.Column('strava_scope', sa.Text(), nullable=True),
    sa.Column('strava_access_token', sa.String(length=40), nullable=True),
    sa.Column('strava_token_expires_at', sa.DateTime(), nullable=True),
    sa.Column('strava_refresh_token', sa.String(length=40), nullable=True),
    sa.Column('strava_athlete_info', sa.JSON(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('strava_id'),
    sa.UniqueConstraint('username')
    )
    op.create_table('db_activity',
    sa.Column('activity_id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('athlete_id', sa.Integer(), nullable=False),
    sa.Column('json', sa.JSON(), nullable=True),
    sa.Column('laps', sa.JSON(), nullable=True),
    sa.Column('streams', sa.JSON(), nullable=True),
    sa.Column('df', sa.JSON(), nullable=True),
    sa.Column('intervals', sa.JSON(), nullable=True),
    sa.Column('blob', sa.LargeBinary(), nullable=True),
    sa.Column('comment', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['athlete_id'], ['user.strava_id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('activity_id')
    )
示例#5
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'template_item', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('type', sa.Integer(), nullable=False),
        sa.Column('title', sa.String(length=255), nullable=False),
        sa.Column('platform', sa.String(length=64), nullable=False),
        sa.Column('description', sa.Text(), nullable=True),
        sa.Column('name', sa.String(length=255), nullable=True),
        sa.Column('logo', sa.Text(), nullable=True),
        sa.Column('image', sa.String(length=128), nullable=True),
        sa.Column('notes', sa.Text(), nullable=True),
        sa.Column('categories', sa.JSON(), nullable=True),
        sa.Column('restart_policy', sa.String(length=20), nullable=True),
        sa.Column('ports', sa.JSON(), nullable=True),
        sa.Column('volumes', sa.JSON(), nullable=True),
        sa.Column('env', sa.JSON(), nullable=True),
        sa.Column('sysctls', sa.JSON(), nullable=True),
        sa.Column('cap_add', sa.JSON(), nullable=True),
        sa.Column('template_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['template_id'],
            ['templates.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_template_item_name'),
                    'template_item', ['name'],
                    unique=False)
    op.create_index(op.f('ix_template_item_title'),
                    'template_item', ['title'],
                    unique=False)
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('quiz',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=128), nullable=False),
    sa.Column('created_by', sa.Integer(), nullable=True),
    sa.Column('created_on', sa.DateTime(), nullable=True),
    sa.Column('last_modified', sa.DateTime(), nullable=True),
    sa.Column('tags', sa.JSON(), nullable=True),
    sa.Column('total_marks', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['created_by'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_index(op.f('ix_quiz_created_by'), 'quiz', ['created_by'], unique=False)
    op.create_index(op.f('ix_quiz_created_on'), 'quiz', ['created_on'], unique=False)
    op.create_table('attempt',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('quiz_id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('response', sa.JSON(), nullable=True),
    sa.Column('score', sa.Integer(), nullable=True),
    sa.Column('comments', sa.String(length=256), nullable=True),
    sa.ForeignKeyConstraint(['quiz_id'], ['quiz.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_attempt_quiz_id'), 'attempt', ['quiz_id'], unique=False)
    op.create_index(op.f('ix_attempt_user_id'), 'attempt', ['user_id'], unique=False)
    op.create_table('question',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('quiz_id', sa.Integer(), nullable=False),
    sa.Column('ques_type', sa.Integer(), nullable=False),
    sa.Column('ques_json', sa.JSON(), nullable=False),
    sa.Column('correct_answer', sa.String(length=64), nullable=False),
    sa.Column('marks', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['quiz_id'], ['quiz.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_question_quiz_id'), 'question', ['quiz_id'], unique=False)
示例#7
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('districts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=200), nullable=True),
    sa.Column('person_in_charge', sa.String(length=200), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('dealers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=200), nullable=True),
    sa.Column('district_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['district_id'], ['districts.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('orders',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('order_no', sa.String(length=30), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('dealer_id', sa.Integer(), nullable=True),
    sa.Column('order_status', sa.String(length=50), nullable=True),
    sa.Column('order_memo', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['dealer_id'], ['dealers.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('order_no')
    )
    op.create_table('contracts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('contract_no', sa.String(length=30), nullable=True),
    sa.Column('contract_date', sa.DateTime(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('order_id', sa.Integer(), nullable=True),
    sa.Column('contract_status', sa.String(length=50), nullable=True),
    sa.Column('product_status', sa.String(length=50), nullable=True),
    sa.Column('shipment_status', sa.String(length=50), nullable=True),
    sa.Column('contract_content', sa.JSON(), nullable=True),
    sa.ForeignKeyConstraint(['order_id'], ['orders.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('contract_no')
    )
    op.create_table('order_contents',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('order_id', sa.Integer(), nullable=True),
    sa.Column('product_name', sa.String(length=300), nullable=True),
    sa.Column('sku_specification', sa.String(length=500), nullable=True),
    sa.Column('sku_code', sa.String(length=30), nullable=True),
    sa.Column('number', sa.Integer(), nullable=True),
    sa.Column('square_num', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['order_id'], ['orders.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
示例#8
0
文件: models.py 项目: rugleb/Invest
class Company(Base):
    __tablename__ = "companies"

    id = sa.Column(sa.BIGINT, primary_key=True)

    # Общая информация
    name = sa.Column(sa.TEXT, nullable=False)
    size = sa.Column(sa.TEXT, nullable=False)
    registered_at = sa.Column(sa.DATE, nullable=False)
    itn = sa.Column(sa.TEXT, unique=True)
    psrn = sa.Column(sa.TEXT, unique=True)
    region_code = sa.Column(sa.TEXT, nullable=False)
    region_name = sa.Column(sa.TEXT, nullable=False)
    activity_code = sa.Column(sa.TEXT)
    activity_name = sa.Column(sa.TEXT)
    charter_capital = sa.Column(sa.BIGINT)
    is_acting = sa.Column(sa.BOOLEAN, nullable=False)

    # Риск факторы
    is_liquidating = sa.Column(sa.BOOLEAN)
    not_reported_last_year = sa.Column(sa.BOOLEAN)
    not_in_same_registry = sa.Column(sa.BOOLEAN)
    ceo_has_other_companies = sa.Column(sa.BOOLEAN)
    negative_list_risk = sa.Column(sa.BOOLEAN)

    # Банкротство
    bankruptcy_probability = sa.Column(sa.INT)
    bankruptcy_vars = sa.Column(sa.JSON(none_as_null=True))

    # Финансы
    is_enough_finance_data = sa.Column(sa.BOOLEAN)
    relative_success = sa.Column(sa.SMALLINT)
    revenue_forecast = sa.Column(sa.BIGINT)
    assets_forecast = sa.Column(sa.BIGINT)
    dev_stage = sa.Column(sa.TEXT)
    dev_stage_coordinates = sa.Column(sa.JSON(none_as_null=True))

    def to_dict(self) -> Dict:
        return CompanySchema().dump(self)
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'events', sa.Column('id',
                            postgresql.UUID(as_uuid=True),
                            nullable=False),
        sa.Column('component', sa.String(), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('data', sa.JSON(), nullable=True),
        sa.Column('email', sa.String(), nullable=True),
        sa.Column('environment', sa.String(), nullable=True),
        sa.Column('message', sa.String(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
示例#10
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'group_match',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('match_id', sa.String(), nullable=False),
        sa.Column('group_id', sa.Integer(), nullable=False),
        sa.Column('creator', sa.Integer(), nullable=False),
        sa.Column('create_date', sa.DateTime(), nullable=False),
        sa.Column('finished', sa.Boolean(), nullable=False),
        sa.Column('players_status', sa.JSON(), nullable=True),
        sa.PrimaryKeyConstraint('id')
    )
示例#11
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "marketplace_sources",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sa.String(), nullable=True),
        sa.Column("index", sa.Integer(), nullable=True),
        sa.Column("created", sa.TIMESTAMP(), nullable=True),
        sa.Column("updated", sa.TIMESTAMP(), nullable=True),
        sa.Column("object", sa.JSON(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
        sa.UniqueConstraint("name", name="_marketplace_sources_uc"),
    )
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('dags', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('key', sa.String(), nullable=True),
                    sa.Column('version', sa.String(), nullable=True),
                    sa.Column('name', sa.String(), nullable=False),
                    sa.Column('description', sa.String(), nullable=True),
                    sa.Column('contact', sa.String(), nullable=True),
                    sa.Column('workbench', sa.JSON(), nullable=False),
                    sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_dags_contact'), 'dags', ['contact'], unique=False)
    op.create_index(op.f('ix_dags_id'), 'dags', ['id'], unique=False)
    op.create_index(op.f('ix_dags_key'), 'dags', ['key'], unique=False)
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('request_storage',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('key_data', sa.String(), nullable=True),
                    sa.Column('data_service', sa.JSON(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_request_storage_id'),
                    'request_storage', ['id'],
                    unique=False)
    op.create_index(op.f('ix_request_storage_key_data'),
                    'request_storage', ['key_data'],
                    unique=True)
示例#14
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('audit_logs',
                    sa.Column('logid', sa.Integer(), nullable=False),
                    sa.Column('timestamp', sa.DateTime(), nullable=True),
                    sa.Column('type', sa.String(), nullable=True),
                    sa.Column('source', sa.String(), nullable=True),
                    sa.Column('destination', sa.String(), nullable=True),
                    sa.Column('data', sa.JSON(), nullable=True),
                    sa.PrimaryKeyConstraint('logid'))
    op.create_index(op.f('ix_audit_logs_logid'),
                    'audit_logs', ['logid'],
                    unique=False)
示例#15
0
class DemocracyProposalAudit(BaseModel):
    __tablename__ = 'data_democracy_proposal_audit'

    id = sa.Column(sa.Integer(), primary_key=True, autoincrement=True)
    democracy_proposal_id = sa.Column(sa.Integer(), nullable=False, index=True)
    block_id = sa.Column(sa.Integer(), index=True, nullable=False)
    extrinsic_idx = sa.Column(sa.Integer())
    event_idx = sa.Column(sa.Integer())
    type_id = sa.Column(sa.Integer(), nullable=False)
    data = sa.Column(sa.JSON(),
                     default=None,
                     server_default=None,
                     nullable=True)
示例#16
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'gis_polygon', sa.Column('_created', sa.DateTime(), nullable=True),
        sa.Column('_updated', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
        sa.Column('class_id', sa.Integer(), nullable=True),
        sa.Column('name', sa.String(), nullable=True),
        sa.Column('props', sa.JSON(), nullable=True),
        sa.Column('geom',
                  geoalchemy2.types.Geometry(geometry_type='POLYGON',
                                             srid=4326),
                  nullable=True), sa.PrimaryKeyConstraint('id'))
示例#17
0
class AccountAudit(BaseModel):
    __tablename__ = 'data_account_audit'

    id = sa.Column(sa.Integer(), primary_key=True, autoincrement=True)
    account_id = sa.Column(sa.String(64), primary_key=True)
    block_id = sa.Column(sa.Integer(), index=True, nullable=False)
    extrinsic_idx = sa.Column(sa.Integer())
    event_idx = sa.Column(sa.Integer())
    type_id = sa.Column(sa.Integer(), nullable=False)
    data = sa.Column(sa.JSON(),
                     default=None,
                     server_default=None,
                     nullable=True)
示例#18
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'comparison_responses',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('created_at', sa.DateTime(timezone=True), nullable=True),
        sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
        sa.Column('response_hash', sa.String(), nullable=True),
        sa.Column('data', sa.JSON(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    with op.batch_alter_table('links', schema=None) as batch_op:
        batch_op.add_column(
            sa.Column('response_hash', sa.String(), nullable=True))
示例#19
0
def upgrade():
    op.create_table(
        'history', sa.Column('id', sa.BIGINT(), primary_key=True),
        sa.Column('play_time', sa.TIMESTAMP(timezone=True), nullable=False),
        sa.Column('data', sa.JSON(), nullable=False))
    op.alter_column('favorites',
                    'account',
                    existing_type=sa.INTEGER(),
                    nullable=False)
    op.alter_column('favorites',
                    'song',
                    existing_type=sa.INTEGER(),
                    nullable=False)
示例#20
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('username', sa.String(), nullable=False),
                    sa.Column('password_hash', sa.String(), nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('username'))
    op.create_table('boards', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('rows', sa.Integer(), nullable=False),
                    sa.Column('columns', sa.Integer(), nullable=False),
                    sa.Column('creation_date', sa.DateTime(), nullable=False),
                    sa.Column('end_date', sa.DateTime(), nullable=True),
                    sa.Column('resume_date', sa.DateTime(), nullable=True),
                    sa.Column('status', sa.String(), nullable=True),
                    sa.Column('mines', sa.JSON(), nullable=True),
                    sa.Column('current_game_state', sa.JSON(), nullable=True),
                    sa.Column('time_elapsed', sa.Interval(), nullable=True),
                    sa.Column('owner_id', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['owner_id'],
                        ['users.id'],
                    ), sa.PrimaryKeyConstraint('id'))
示例#21
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'model', sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=256), nullable=False),
        sa.Column('model_serialized', sa.JSON(), nullable=False),
        sa.Column('organism_id', sa.String(length=256), nullable=False),
        sa.Column('project_id', sa.Integer(), nullable=True),
        sa.Column('default_biomass_reaction',
                  sa.String(length=256),
                  nullable=False), sa.PrimaryKeyConstraint('id'))
示例#22
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'Artist', sa.Column('artist_id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(), nullable=False),
        sa.Column('city', sa.String(length=120), nullable=False),
        sa.Column('state', sa.String(length=120), nullable=False),
        sa.Column('phone', sa.String(length=120), nullable=False),
        sa.Column('genres', sa.JSON(), nullable=False),
        sa.Column('seeking_venue', sa.String(length=5), nullable=False),
        sa.Column('seeking_description', sa.String(length=500), nullable=True),
        sa.Column('website', sa.String(length=500), nullable=True),
        sa.Column('image_link', sa.String(length=500), nullable=True),
        sa.Column('facebook_link', sa.String(length=120), nullable=True),
        sa.PrimaryKeyConstraint('artist_id'))
    op.create_table(
        'Venue', sa.Column('venue_id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(), nullable=False),
        sa.Column('genres', sa.JSON(), nullable=False),
        sa.Column('city', sa.String(length=120), nullable=False),
        sa.Column('state', sa.String(length=120), nullable=False),
        sa.Column('address', sa.String(length=120), nullable=False),
        sa.Column('phone', sa.String(length=120), nullable=False),
        sa.Column('image_link', sa.String(length=500), nullable=True),
        sa.Column('website', sa.String(length=500), nullable=True),
        sa.Column('facebook_link', sa.String(length=120), nullable=True),
        sa.Column('seeking_talent', sa.String(length=5), nullable=False),
        sa.Column('seeking_description', sa.String(length=500), nullable=True),
        sa.PrimaryKeyConstraint('venue_id'))
    op.create_table(
        'Show', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('venue_id', sa.Integer(), nullable=False),
        sa.Column('artist_id', sa.Integer(), nullable=False),
        sa.Column('start_time', sa.DateTime(), nullable=False),
        sa.ForeignKeyConstraint(['artist_id'], ['Artist.artist_id'],
                                ondelete='cascade'),
        sa.ForeignKeyConstraint(['venue_id'], ['Venue.venue_id'],
                                ondelete='cascade'),
        sa.PrimaryKeyConstraint('id'))
示例#23
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'topic', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('referer', sa.String(length=1023), nullable=True),
        sa.Column('url', sa.String(length=1023), nullable=True),
        sa.Column('url_cache', sa.String(length=1023), nullable=True),
        sa.Column('title', sa.String(length=1023), nullable=True),
        sa.Column('summary', sa.String(length=1023), nullable=True),
        sa.Column('memo', sa.String(length=1023), nullable=False),
        sa.Column('detail', sa.JSON(), nullable=False),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_topic_id'), 'topic', ['id'], unique=False)
示例#24
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'processes', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('process_id', sa.String(length=128), nullable=False),
        sa.Column('description', sa.String(length=512), nullable=False),
        sa.Column('git_uri', sa.String(length=128), nullable=False),
        sa.Column('git_ref', sa.String(length=128), nullable=False),
        sa.Column('process_type', sa.String(length=128), nullable=False),
        sa.Column('args', sa.JSON(), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=False),
        sa.PrimaryKeyConstraint('id'))
示例#25
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('controller_attribute_data', sa.Column('properties', sa.JSON(), nullable=True))
    op.add_column('controller_parameter_data', sa.Column('properties', sa.JSON(), nullable=True))
    op.add_column('controller_power_supply_attribute_data', sa.Column('properties', sa.JSON(), nullable=True))
    op.add_column('environment_sensor_attribute_data', sa.Column('properties', sa.JSON(), nullable=True))
    op.add_column('power_supply_attribute_data', sa.Column('properties', sa.JSON(), nullable=True))
    op.add_column('sensor_attribute_data', sa.Column('properties', sa.JSON(), nullable=True))
示例#26
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "workflow",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sa.String(), nullable=True),
        sa.Column("description", sa.String(), nullable=True),
        sa.Column("is_active", sa.Boolean(), nullable=True),
        sa.Column("parameters", sa.JSON(), nullable=True),
        sa.Column("resource_id", sa.String(), nullable=True),
        sa.Column("plugin_slug", sa.String(), nullable=True),
        sa.Column("search_vector",
                  sqlalchemy_utils.types.ts_vector.TSVectorType(),
                  nullable=True),
        sa.Column("created_at", sa.DateTime(), nullable=True),
        sa.Column("updated_at", sa.DateTime(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(
        "ix_workflow_search_vector",
        "workflow",
        ["search_vector"],
        unique=False,
        postgresql_using="gin",
    )
    op.create_table(
        "workflow_instance",
        sa.Column("resource_type", sa.String(), nullable=True),
        sa.Column("resource_id", sa.String(), nullable=True),
        sa.Column("weblink", sa.String(), nullable=True),
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("workflow_id", sa.Integer(), nullable=True),
        sa.Column("creator_id", sa.Integer(), nullable=True),
        sa.Column("status", sa.String(), nullable=True),
        sa.Column("incident_id", sa.Integer(), nullable=True),
        sa.Column("created_at", sa.DateTime(), nullable=True),
        sa.Column("updated_at", sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(
            ["creator_id"],
            ["participant.id"],
        ),
        sa.ForeignKeyConstraint(
            ["incident_id"],
            ["incident.id"],
        ),
        sa.ForeignKeyConstraint(
            ["workflow_id"],
            ["workflow.id"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
示例#27
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "source",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("path", sa.String(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
        sa.UniqueConstraint("path"),
    )
    op.create_table(
        "formula",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sa.Text(), nullable=True),
        sa.Column("source_id", sa.Integer(), nullable=False),
        sa.Column("json", sa.JSON(), nullable=True),
        sa.ForeignKeyConstraint(["source_id"], ["source.id"]),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "problem",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("source_id", sa.Integer(), nullable=False),
        sa.Column("conjecture_id", sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(["conjecture_id"], ["formula.id"]),
        sa.ForeignKeyConstraint(["source_id"], ["source.id"]),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "association",
        sa.Column("left_id", sa.Integer(), nullable=False),
        sa.Column("right_id", sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(["left_id"], ["problem.id"]),
        sa.ForeignKeyConstraint(["right_id"], ["formula.id"]),
    )
    op.create_table(
        "solution",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("problem_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(["problem_id"], ["problem.id"]),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "solution_item",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("solution_id", sa.Integer(), nullable=False),
        sa.Column("premise_id", sa.Integer(), nullable=False),
        sa.Column("used", sa.Boolean(), nullable=True),
        sa.ForeignKeyConstraint(["premise_id"], ["formula.id"]),
        sa.ForeignKeyConstraint(["solution_id"], ["solution.id"]),
        sa.PrimaryKeyConstraint("id"),
    )
示例#28
0
class SessionValidator(BaseModel):
    __tablename__ = 'data_session_validator'

    session_id = sa.Column(sa.Integer(), primary_key=True, autoincrement=False)
    rank_validator = sa.Column(sa.Integer(), primary_key=True, autoincrement=False, index=True)
    validator_stash = sa.Column(sa.String(64), index=True)
    validator_stash_account = relationship(Account, foreign_keys=[validator_stash], primaryjoin=validator_stash == Account.id, lazy='subquery')
    validator_controller = sa.Column(sa.String(64), index=True)
    validator_controller_account = relationship(Account, foreign_keys=[validator_controller],
                                           primaryjoin=validator_controller == Account.id)
    validator_session = sa.Column(sa.String(64), index=True)
    bonded_total = sa.Column(sa.Numeric(precision=65, scale=0), nullable=False)
    bonded_active = sa.Column(sa.Numeric(precision=65, scale=0), nullable=False)
    bonded_nominators = sa.Column(sa.Numeric(precision=65, scale=0), nullable=False)
    bonded_own = sa.Column(sa.Numeric(precision=65, scale=0), nullable=False)
    unlocking = sa.Column(sa.JSON(), default=None, server_default=None, nullable=True)
    count_nominators = sa.Column(sa.Integer(), nullable=True)
    unstake_threshold = sa.Column(sa.Integer(), nullable=True)
    commission = sa.Column(sa.Numeric(precision=65, scale=0), nullable=True)

    def serialize_id(self):
        return '{}-{}'.format(self.session_id, self.rank_validator)

    def serialize_formatting_hook(self, obj_dict):

        if self.validator_stash_account:
            obj_dict['attributes']['validator_stash_account'] = self.validator_stash_account.serialize()

        obj_dict['attributes']['validator_stash_id'] = self.validator_stash
        if self.validator_stash:
            obj_dict['attributes']['validator_stash'] = ss58_encode(self.validator_stash.replace('0x', ''),
                                                                    SUBSTRATE_ADDRESS_TYPE)
        else:
            obj_dict['attributes']['validator_stash'] = None

        obj_dict['attributes']['validator_controller_id'] = self.validator_controller

        if self.validator_controller:
            obj_dict['attributes']['validator_controller'] = ss58_encode(self.validator_controller.replace('0x', ''),
                                                                         SUBSTRATE_ADDRESS_TYPE)
        else:
            obj_dict['attributes']['validator_controller'] = None

        obj_dict['attributes']['validator_session_id'] = self.validator_session
        if self.validator_session:
            obj_dict['attributes']['validator_session'] = ss58_encode(self.validator_session.replace('0x', ''),
                                                                      SUBSTRATE_ADDRESS_TYPE)
        else:
            obj_dict['attributes']['validator_session'] = None

        return obj_dict
示例#29
0
class Account(BaseModel):
    __tablename__ = 'data_account'

    id = sa.Column(sa.String(64), primary_key=True)
    address = sa.Column(sa.String(48), index=True)
    index_address = sa.Column(sa.String(24), index=True)
    is_reaped = sa.Column(sa.Boolean, default=False)

    is_validator = sa.Column(sa.Boolean, default=False, index=True)
    was_validator = sa.Column(sa.Boolean, default=False, index=True)
    is_nominator = sa.Column(sa.Boolean, default=False, index=True)
    was_nominator = sa.Column(sa.Boolean, default=False, index=True)
    is_council_member = sa.Column(sa.Boolean, default=False, index=True)
    was_council_member = sa.Column(sa.Boolean, default=False, index=True)
    is_tech_comm_member = sa.Column(sa.Boolean, default=False, index=True)
    was_tech_comm_member = sa.Column(sa.Boolean, default=False, index=True)
    is_registrar = sa.Column(sa.Boolean, default=False, index=True)
    was_registrar = sa.Column(sa.Boolean, default=False, index=True)
    is_sudo = sa.Column(sa.Boolean, default=False, index=True)
    was_sudo = sa.Column(sa.Boolean, default=False, index=True)

    is_treasury = sa.Column(sa.Boolean, default=False, index=True)
    is_contract = sa.Column(sa.Boolean, default=False, index=True)

    count_reaped = sa.Column(sa.Integer(), default=0)
    hash_blake2b = sa.Column(sa.String(64), index=True, nullable=True)

    balance_total = sa.Column(sa.Numeric(precision=65, scale=0), nullable=True, index=True)
    balance_free = sa.Column(sa.Numeric(precision=65, scale=0), nullable=True, index=True)
    balance_reserved = sa.Column(sa.Numeric(precision=65, scale=0), nullable=True, index=True)
    nonce = sa.Column(sa.Integer(), nullable=True)
    account_info = sa.Column(sa.JSON(), default=None, server_default=None, nullable=True)

    has_identity = sa.Column(sa.Boolean, default=False, index=True)
    has_subidentity = sa.Column(sa.Boolean, default=False, index=True)
    identity_display = sa.Column(sa.String(32), index=True, nullable=True)
    identity_legal = sa.Column(sa.String(32), nullable=True)
    identity_web = sa.Column(sa.String(32), nullable=True)
    identity_riot = sa.Column(sa.String(32), nullable=True)
    identity_email = sa.Column(sa.String(32), nullable=True)
    identity_twitter = sa.Column(sa.String(32), nullable=True)
    identity_judgement_good = sa.Column(sa.Integer(), default=0)
    identity_judgement_bad = sa.Column(sa.Integer(), default=0)
    parent_identity = sa.Column(sa.String(64), index=True, nullable=True)
    subidentity_display = sa.Column(sa.String(32), nullable=True)

    created_at_block = sa.Column(sa.Integer(), nullable=False)
    updated_at_block = sa.Column(sa.Integer(), nullable=False)

    def serialize_id(self):
        return self.id
示例#30
0
def upgrade():
    """Upgrade database."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('oarepo_oai_provider',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('code', sa.String(length=16), nullable=False),
                    sa.Column('description', sa.String(length=2048), nullable=True),
                    sa.Column('oai_endpoint', sa.String(length=2048), nullable=False),
                    sa.Column('metadata_prefix', sa.String(length=32), nullable=True),
                    sa.Column('constant_fields', sa.JSON().with_variant(
                        sqlalchemy_utils.types.json.JSONType(), 'mysql').with_variant(
                        postgresql.JSONB(none_as_null=True, astext_type=sa.Text()),
                        'postgresql').with_variant(sqlalchemy_utils.types.json.JSONType(),
                                                   'sqlite'), nullable=True),
                    sa.PrimaryKeyConstraint('id', name=op.f('pk_oarepo_oai_provider')),
                    sa.UniqueConstraint('code', name=op.f('uq_oarepo_oai_provider_code'))
                    )
    op.create_table('oarepo_oai_sync',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('provider_id', sa.Integer(), nullable=True),
                    sa.Column('sync_start', sa.TIMESTAMP(), nullable=True),
                    sa.Column('sync_end', sa.TIMESTAMP(), nullable=True),
                    sa.Column('status', sa.String(length=32), nullable=True),
                    sa.Column('logs', sa.String(length=2048), nullable=True),
                    sa.Column('rec_created', sa.Integer(), nullable=True),
                    sa.Column('rec_modified', sa.Integer(), nullable=True),
                    sa.Column('rec_deleted', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(['provider_id'], ['oarepo_oai_provider.id'], name=op.f(
                        'fk_oarepo_oai_sync_provider_id_oarepo_oai_provider')),
                    sa.PrimaryKeyConstraint('id', name=op.f('pk_oarepo_oai_sync'))
                    )
    op.create_table('oarepo_oai_record',
                    sa.Column('id', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
                    sa.Column('oai_identifier', sa.String(length=2048), nullable=False),
                    sa.Column('last_sync_id', sa.INTEGER(), nullable=True),
                    sa.Column('modification_sync_id', sa.INTEGER(), nullable=True),
                    sa.Column('creation_sync_id', sa.INTEGER(), nullable=True),
                    sa.Column('timestamp', sa.TIMESTAMP(), nullable=False),
                    sa.ForeignKeyConstraint(['creation_sync_id'], ['oarepo_oai_sync.id'], name=op.f(
                        'fk_oarepo_oai_record_creation_sync_id_oarepo_oai_sync')),
                    sa.ForeignKeyConstraint(['id'], ['records_metadata.id'],
                                            name=op.f('fk_oarepo_oai_record_id_records_metadata')),
                    sa.ForeignKeyConstraint(['last_sync_id'], ['oarepo_oai_sync.id'], name=op.f(
                        'fk_oarepo_oai_record_last_sync_id_oarepo_oai_sync')),
                    sa.ForeignKeyConstraint(['modification_sync_id'], ['oarepo_oai_sync.id'],
                                            name=op.f(
                                                'fk_oarepo_oai_record_modification_sync_id_oarepo_oai_sync')),
                    sa.PrimaryKeyConstraint('id', name=op.f('pk_oarepo_oai_record')),
                    sa.UniqueConstraint('oai_identifier',
                                        name=op.f('uq_oarepo_oai_record_oai_identifier'))
                    )