Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sa.Column('updated', sa.DateTime(timezone=True), nullable=True),
sa.ForeignKeyConstraint(['assignment_id'], ['assignment.id'], name=op.f('fk_group_member_assignment_id_assignment')),
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_group_member_group_id_group')),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_group_member_user_id_user')),
sa.PrimaryKeyConstraint('user_id', 'assignment_id', name=op.f('pk_group_member'))
)
op.create_index(op.f('ix_group_member_group_id'), 'group_member', ['group_id'], unique=False)
op.create_index(op.f('ix_group_member_status'), 'group_member', ['status'], unique=False)
op.create_index(op.f('ix_group_member_user_id'), 'group_member', ['user_id'], unique=False)
op.create_table('message',
sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('backup_id', sa.Integer(), nullable=False),
sa.Column('contents', server.models.JsonBlob(), nullable=False),
sa.Column('kind', sa.String(length=255), nullable=False),
sa.ForeignKeyConstraint(['backup_id'], ['backup.id'], name=op.f('fk_message_backup_id_backup')),
sa.PrimaryKeyConstraint('id', name=op.f('pk_message')),
mysql_row_format=os.getenv('DB_ROW_FORMAT', 'COMPRESSED')
)
op.create_index(op.f('ix_message_backup_id'), 'message', ['backup_id'], unique=False)
op.create_index(op.f('ix_message_kind'), 'message', ['kind'], unique=False)
op.create_table('score',
sa.Column('created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('grader_id', sa.Integer(), nullable=False),
sa.Column('assignment_id', sa.Integer(), nullable=False),
sa.Column('backup_id', sa.Integer(), nullable=False),
sa.Column('kind', sa.String(length=255), nullable=False),
sa.Column('score', sa.Float(), nullable=False),
sa.Column('message', mysql.MEDIUMTEXT(), nullable=True),
sa.Column('public', sa.Boolean(), nullable=True),
sa.Column('archived', sa.Boolean(), nullable=True),
def upgrade():
op.create_table(
"tokens",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("type", sa.String(length=32), nullable=True),
sa.Column("user_id", sa.Integer(), nullable=True),
sa.Column("created", sa.DateTime(), nullable=True),
sa.Column("expiration", sa.DateTime(), nullable=True),
sa.Column("value", sa.String(length=128), nullable=True),
sa.ForeignKeyConstraint(["user_id"], ["users.id"], ondelete="CASCADE"),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("value"),
)
sa.Column("pool_name_id", sa.Integer(), nullable=False),
sa.Column("pool_id", sa.Integer(), nullable=False),
sa.Column("name", sa.Unicode(length=256), nullable=False),
sa.Column("ord", sa.Integer(), nullable=False, index=True),
sa.ForeignKeyConstraint(["pool_id"], ["pool.id"]),
sa.PrimaryKeyConstraint("pool_name_id"),
sa.UniqueConstraint("name"),
)
op.create_table(
"pool_post",
sa.Column("pool_id", sa.Integer(), nullable=False),
sa.Column("post_id", sa.Integer(), nullable=False, index=True),
sa.Column("ord", sa.Integer(), nullable=False, index=True),
sa.ForeignKeyConstraint(["pool_id"], ["pool.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(["post_id"], ["post.id"], ondelete="CASCADE"),
sa.PrimaryKeyConstraint("pool_id", "post_id"),
)
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('events_teams',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('description', sa.String(length=255), nullable=False),
sa.Column('active', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('events_asset',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('description', sa.String(length=255), nullable=False),
sa.Column('location_id', sa.Integer(), nullable=True),
sa.Column('active', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['location_id'], ['places_location.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('events_event',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=255), nullable=False),
sa.Column('description', sa.String(length=255), nullable=True),
sa.Column('start', sa.DateTime(), nullable=False),
sa.Column('end', sa.DateTime(), nullable=False),
sa.Column('location_id', sa.Integer(), nullable=True),
sa.Column('active', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['location_id'], ['places_location.id'], ),
sa.PrimaryKeyConstraint('id')
)
sa.Column("created_at", sa.DateTime(), nullable=True),
sa.Column("creator", sa.String(length=64), nullable=True),
sa.ForeignKeyConstraint(["creator"], ["user.username"]),
sa.PrimaryKeyConstraint("id"),
)
op.create_table(
"todo",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("description", sa.String(length=128), nullable=True),
sa.Column("created_at", sa.DateTime(), nullable=True),
sa.Column("finished_at", sa.DateTime(), nullable=True),
sa.Column("is_finished", sa.Boolean(), nullable=True),
sa.Column("creator", sa.String(length=64), nullable=True),
sa.Column("todolist_id", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(["creator"], ["user.username"]),
sa.ForeignKeyConstraint(["todolist_id"], ["todolist.id"]),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(op.f("ix_todo_created_at"), "todo", ["created_at"], unique=False)
op.create_index(op.f("ix_todo_finished_at"), "todo", ["finished_at"], unique=False)
### end Alembic commands ###
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('page',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('day_id', sa.Integer(), nullable=True),
sa.Column('sequence', sa.Integer(), nullable=True),
sa.Column('binary', sa.Binary(), nullable=True),
sa.Column('title', sa.Unicode(length=1024), nullable=True),
sa.ForeignKeyConstraint(['day_id'], ['day.id'], ),
sa.PrimaryKeyConstraint('id')
)
sa.Column('address', sa.Text(), nullable=True),
sa.Column('phone', sa.String(), nullable=True),
sa.ForeignKeyConstraint(['person_id'], ['events.persons.id']),
sa.ForeignKeyConstraint(['subcontribution_id'], ['events.subcontributions.id']),
sa.UniqueConstraint('person_id', 'subcontribution_id'),
sa.PrimaryKeyConstraint('id'),
schema='events'
)
# LegacyContributionMapping
op.create_table(
'legacy_contribution_id_map',
sa.Column('event_id', sa.Integer(), autoincrement=False, nullable=False),
sa.Column('legacy_contribution_id', sa.String(), nullable=False),
sa.Column('contribution_id', sa.Integer(), nullable=False, index=True),
sa.ForeignKeyConstraint(['contribution_id'], ['events.contributions.id']),
sa.ForeignKeyConstraint(['event_id'], ['events.events.id']),
sa.PrimaryKeyConstraint('event_id', 'legacy_contribution_id'),
schema='events'
)
# LegacySubContributionMapping
op.create_table(
'legacy_subcontribution_id_map',
sa.Column('event_id', sa.Integer(), autoincrement=False, nullable=False),
sa.Column('legacy_contribution_id', sa.String(), nullable=False),
sa.Column('legacy_subcontribution_id', sa.String(), nullable=False),
sa.Column('subcontribution_id', sa.Integer(), nullable=False, index=True),
sa.ForeignKeyConstraint(['subcontribution_id'], ['events.subcontributions.id'],
name='fk_legacy_subcontribution_id_map_subcontribution'),
sa.ForeignKeyConstraint(['event_id'], ['events.events.id']),
sa.PrimaryKeyConstraint('event_id', 'legacy_contribution_id', 'legacy_subcontribution_id'),
def upgrade():
op.create_table('l2gateways',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255),
nullable=True),
sa.PrimaryKeyConstraint('id'))
op.create_table('l2gatewaydevices',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('device_name', sa.String(length=255),
nullable=False),
sa.Column('l2_gateway_id', sa.String(length=36),
nullable=False),
sa.ForeignKeyConstraint(['l2_gateway_id'],
['l2gateways.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'))
op.create_table('l2gatewayinterfaces',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('interface_name', sa.String(length=255),
nullable=True),
sa.Column('segmentation_id', sa.Integer(),
nullable=True),
sa.Column('device_id', sa.String(length=36),
nullable=False),
sa.ForeignKeyConstraint(['device_id'],
['l2gatewaydevices.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'))
)
op.create_table('freshman_hm_attendance',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('fid', sa.Integer(), nullable=False),
sa.Column('meeting_id', sa.Integer(), nullable=False),
sa.Column('excuse', sa.Text(), nullable=True),
sa.Column('attendance_status', sa.Enum('Attended', 'Excused', 'Absent', name='attendance_enum'), nullable=True),
sa.ForeignKeyConstraint(['fid'], ['freshman_accounts.id'], ),
sa.ForeignKeyConstraint(['meeting_id'], ['house_meetings.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('freshman_seminar_attendance',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('fid', sa.Integer(), nullable=False),
sa.Column('seminar_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['fid'], ['freshman_accounts.id'], ),
sa.ForeignKeyConstraint(['seminar_id'], ['technical_seminars.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('member_committee_attendance',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('uid', sa.String(length=32), nullable=False),
sa.Column('meeting_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['meeting_id'], ['committee_meetings.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('member_hm_attendance',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('uid', sa.String(length=32), nullable=False),
sa.Column('meeting_id', sa.Integer(), nullable=False),
sa.Column('excuse', sa.Text(), nullable=True),
sa.Column('attendance_status', sa.Enum('Attended', 'Excused', 'Absent', name='attendance_enum'), nullable=True),
op.create_table('fru',
sa.Column('node_id', sa.Integer(), nullable=False),
sa.Column('fru_type_id', sa.Integer(), nullable=False),
sa.Column('fru_id', sa.Integer(), autoincrement=True, unique=True, nullable=False),
sa.Column('serial_number', sa.String(length=50), nullable=False),
sa.ForeignKeyConstraint(['fru_type_id'], ['fru_type.fru_type_id'], name=op.f('fk_fru_fru_type_id_fru_type')),
sa.ForeignKeyConstraint(['node_id'], ['node.node_id'], name=op.f('fk_fru_node_id_node')),
sa.PrimaryKeyConstraint('node_id', 'fru_type_id', 'fru_id', name=op.f('pk_fr')))
op.create_table('maintenance_record',
sa.Column('node_id', sa.Integer(), nullable=False),
sa.Column('fru_type_id', sa.Integer(), nullable=False),
sa.Column('fru_id', sa.Integer(), nullable=False),
sa.Column('replacement_date', sa.Date(), nullable=False),
sa.Column('old_serial_number', sa.String(length=50), nullable=False),
sa.Column('new_serial_number', sa.String(length=50), nullable=False),
sa.ForeignKeyConstraint(['node_id', 'fru_type_id', 'fru_id'], ['fru.node_id', 'fru.fru_type_id', 'fru.fru_id'],
name=op.f('fk_maintenance_record_node_id_fr')),
sa.PrimaryKeyConstraint('node_id', 'fru_type_id', 'fru_id', 'replacement_date', name=op.f('pk_maintenance_record')))
op.create_table('data_sample',
sa.Column('node_id', sa.Integer(), nullable=False),
sa.Column('data_item_id', sa.Integer(), nullable=False),
sa.Column('time_stamp', sa.DateTime(), nullable=False),
sa.Column('value_int', sa.BigInteger()),
sa.Column('value_real', sa.Float(precision=53)),
sa.Column('value_str', sa.String(length=50)),
sa.Column('units', sa.String(length=50)),
sa.ForeignKeyConstraint(['data_item_id'], ['data_item.data_item_id'], name=op.f('fk_data_sample_data_item_id_data_item')),
sa.ForeignKeyConstraint(['node_id'], ['node.node_id'], name=op.f('fk_data_sample_node_id_node')),
sa.PrimaryKeyConstraint('node_id', 'data_item_id', 'time_stamp', name=op.f('pk_data_sample')),
sa.CheckConstraint('(value_int IS NOT NULL OR value_real IS NOT NULL OR value_str IS NOT NULL)',
name=op.f('ck_data_sample_at_least_one_value')))
op.create_table('job',