Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def upgrade():
op.alter_column(
'profile',
'latest_submission_time',
new_column_name='latest_submission_time_old',
)
op.add_column(
'profile',
sa.Column('latest_submission_time', libweasyl.models.helpers.ArrowColumn(), nullable=False, server_default='epoch'),
)
op.execute(
"UPDATE profile SET latest_submission_time = TIMESTAMP WITHOUT TIME ZONE 'epoch' + "
"(latest_submission_time_old - %d) * INTERVAL '1 second'" % (UNIXTIME_OFFSET,))
op.drop_column('profile', 'latest_submission_time_old')
def upgrade():
op.add_column(
'violations',
sa.Column('review_is_active', sa.Integer, nullable=False, server_default='1')
)
connection = op.get_bind()
connection.execute('''UPDATE violations
SET review_is_active = 0
WHERE review_id IN (SELECT id FROM reviews WHERE is_active = 0)''')
op.create_index(
'idx_key_domain_review_active',
'violations',
['key_id', 'domain_id', 'review_is_active'])
def upgrade():
op.add_column('ps_aors', sa.Column('qualify_timeout', sa.Integer))
op.add_column('ps_contacts', sa.Column('qualify_timeout', sa.Integer))
def upgrade():
''' Add the column notification to the table pull_request_comments.
'''
op.add_column(
'pull_request_comments',
sa.Column('notification', sa.Boolean, default=False, nullable=True)
)
op.execute('''UPDATE "pull_request_comments" SET notification=False;''')
op.alter_column(
'pull_request_comments', 'notification',
nullable=False, existing_nullable=True)
op.create_table('participant_cohort_pilot',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('modified', sa.DateTime(), nullable=True),
sa.Column('participant_id', sa.Integer(), nullable=True),
sa.Column('consent_date', sa.Date(), nullable=True),
sa.Column('enrollment_status_core_stored_sample_date', sa.Date(), nullable=True),
sa.Column('cluster', sa.SmallInteger(), nullable=True),
sa.Column('participant_cohort', rdr_service.model.utils.Enum(ParticipantCohort), nullable=True),
sa.Column('participant_cohort_pilot', rdr_service.model.utils.Enum(ParticipantCohortPilotFlag), nullable=True),
sa.ForeignKeyConstraint(['participant_id'], ['participant.participant_id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_participant_cohort_pilot_created'), 'participant_cohort_pilot', ['created'], unique=False)
op.create_index('participant_cohort_participantId', 'participant_cohort_pilot', ['participant_id'], unique=False)
op.add_column('participant_summary', sa.Column('cohort_2_pilot_flag', rdr_service.model.utils.Enum(ParticipantCohortPilotFlag), nullable=True))
# ### end Alembic commands ###
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("person", sa.Column("weight", sa.Float(), nullable=True))
### end Alembic commands ###
def upgrade():
op.add_column('node_group_templates',
sa.Column('volume_local_to_instance', sa.Boolean()))
op.add_column('node_groups',
sa.Column('volume_local_to_instance', sa.Boolean()))
op.add_column('templates_relations',
sa.Column('volume_local_to_instance', sa.Boolean()))
snapshot_support_extra_spec else 'False')
# Copy the snapshot_support value to create_share_from_snapshot_support
extra_specs.append({
'spec_key':
constants.ExtraSpecs.CREATE_SHARE_FROM_SNAPSHOT_SUPPORT,
'spec_value': spec_value,
'deleted': 0,
'created_at': now,
'share_type_id': share_type.id,
})
if extra_specs:
op.bulk_insert(extra_specs_table, extra_specs)
# Add create_share_from_snapshot_support attribute to shares table
op.add_column('shares',
sa.Column('create_share_from_snapshot_support',
sa.Boolean, default=True))
# Copy snapshot_support to create_share_from_snapshot_support on each share
shares_table = sa.Table(
'shares',
sa.MetaData(),
sa.Column('id', sa.String(length=36)),
sa.Column('deleted', sa.String(length=36)),
sa.Column('snapshot_support', sa.Boolean),
sa.Column('create_share_from_snapshot_support', sa.Boolean),
)
# pylint: disable=no-value-for-parameter
update = shares_table.update().where(
shares_table.c.deleted == 'False').values(
create_share_from_snapshot_support=shares_table.c.snapshot_support)
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("tb_stream_chunk_highlight", sa.Column("last_edited_by", sa.Integer(), nullable=True))
op.create_foreign_key(None, "tb_stream_chunk_highlight", "tb_user", ["last_edited_by"], ["id"])
### end Alembic commands ###
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('rlmss', sa.Column('public_identifier', sa.Unicode(length=50), nullable=False))
op.add_column('rlmss', sa.Column('publicly_available', sa.Boolean(), nullable=False))
op.create_index('ix_rlmss_publicly_available', 'rlmss', ['publicly_available'], unique=False)
### end Alembic commands ###