Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
session = sa.orm.session.Session(bind=op.get_bind())
if session.query(User).count() >= 0:
for user in session.query(User).all():
password_hash_length = len(user.password_hash)
if password_hash_length == 40:
user.password_revision = 1
elif password_hash_length == 64:
user.password_revision = 2
else:
user.password_revision = 0
session.flush()
session.commit()
op.alter_column(
"user", "password_revision", existing_nullable=True, nullable=False
)
def upgrade():
op.alter_column('firewall_rules_v2', 'public', new_column_name='shared',
existing_type=sa.Boolean)
op.alter_column('firewall_groups_v2', 'public', new_column_name='shared',
existing_type=sa.Boolean)
op.alter_column('firewall_policies_v2', 'public', new_column_name='shared',
existing_type=sa.Boolean)
def downgrade():
op.drop_column(u'crontabber_log', u'duration')
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('locks',
sa.Column('lock_id', sa.String(length=64), nullable=False),
sa.Column('acquired_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('lock_id', name=op.f('pk_locks')),
sa.UniqueConstraint('lock_id', name=op.f('uq_locks_lock_id'))
)
op.create_table('notifications',
sa.Column('id', sa.String(length=32), nullable=False),
sa.Column('broadcasted', sa.DateTime(), nullable=True),
sa.Column('subject', sa.String(length=255), nullable=True),
sa.Column('message', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('pk_notifications'))
)
op.create_table('plugins',
sa.Column('id', sa.String(length=32), nullable=False),
sa.Column('name', sa.String(length=32), nullable=True),
sa.Column('schema', sa.Text(), nullable=True),
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"misago_users",
sa.Column("id", sa.BigInteger(), nullable=False),
sa.Column("name", sa.String(length=50), nullable=False),
sa.Column("slug", sa.String(length=50), nullable=False),
sa.Column("email", sa.String(length=255), nullable=False),
sa.Column("email_hash", sa.String(length=255), nullable=False),
sa.Column("password", sa.String(length=255), nullable=True),
sa.Column("is_deactivated", sa.Boolean(), nullable=False),
sa.Column("is_moderator", sa.Boolean(), nullable=False),
sa.Column("is_admin", sa.Boolean(), nullable=False),
sa.Column("joined_at", sa.DateTime(), nullable=False),
sa.Column("extra", sa.JSON(), nullable=False),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("email"),
sa.UniqueConstraint("email_hash"),
sa.UniqueConstraint("slug"),
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('scheme_types',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('description', sa.String(), nullable=False),
sa.Column('default_value', sa.String(), nullable=False),
sa.Column('value_type', sa.String(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('description')
)
op.add_column('scheme_conditions', sa.Column('scheme_type_id', sa.Integer(), nullable=True))
op.create_foreign_key(None, 'scheme_conditions', 'scheme_types', ['scheme_type_id'], ['id'])
# ### end Alembic commands ###
def upgrade_production():
### commands auto generated by Alembic - please adjust! ###
op.add_column('experiment_things', sa.Column('query_index', sa.String(length=256), nullable=True))
op.create_index(op.f('ix_experiment_things_object_created'), 'experiment_things', ['object_created'], unique=False)
op.create_index(op.f('ix_experiment_things_query_index'), 'experiment_things', ['query_index'], unique=False)
### end Alembic commands ###
def upgrade():
op.add_column(
u'amphora',
sa.Column(u'load_balancer_id', sa.String(36),
sa.ForeignKey(u'load_balancer.id',
name=u'fk_amphora_load_balancer_id'),
nullable=True)
)
op.drop_table(u'load_balancer_amphora')
op.drop_constraint(
u'fk_container_provisioning_status_name', u'amphora',
type_=u'foreignkey'
)
op.create_foreign_key(
u'fk_amphora_provisioning_status_name', u'amphora',
u'provisioning_status', [u'status'], [u'name']
)
def upgrade():
############################# Enums ##############################
# yesno_values have already been created, so use postgres enum object
# type to get around "already created" issue - works okay with mysql
yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
op.add_column('ps_globals', sa.Column('ignore_uri_user_options', yesno_values))
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('officers', sa.Column('last_employment_date', sa.Date(), nullable=True))
op.add_column('officers', sa.Column('last_employment_details', sa.String(length=120), nullable=True))
# ### end Alembic commands ###