Did I find the right examples for you? yes no

All Samples(611)  |  Call(611)  |  Derive(0)  |  Import(0)
Issue an "alter column" instruction using the
current migration context.

Generally, only that aspect of the column which
is being changed, i.e. name, type, nullability,
default, needs to be specified.  Multiple changes
can also be specified at once and the backend should
"do the right thing", emitting each change either
separately or together as the backend allows.
(more...)

src/i/n/inbox-HEAD/migrations/versions/011_use_server_default.py   inbox(Download)
def upgrade():
    # Base tables
    op.alter_column('account', 'save_raw_messages',
                    server_default=sa.sql.expression.true(),
                    existing_type=sa.Boolean,
                    existing_server_default=sa.sql.expression.null(),
                    existing_nullable=None)
    op.alter_column('namespace', 'type',
                    existing_server_default=sa.sql.expression.null(),
                    existing_nullable=False)
    op.alter_column('message', 'is_draft',
                    server_default=sa.sql.expression.false(),
                    existing_type=sa.Boolean,
                    existing_server_default=sa.sql.expression.null(),
                    existing_nullable=False)
    op.alter_column('message', 'decode_error',
                    existing_server_default=sa.sql.expression.null(),
                    existing_nullable=False)
    op.alter_column('block', 'is_inboxapp_attachment',
                    server_default=sa.sql.expression.false(),
                    existing_type=sa.Boolean,

src/i/n/inbox-HEAD/migrations/versions/007_per_provider_table_split.py   inbox(Download)
def genericize_namespace_contact_foldersync():
    # Namespace
    op.drop_constraint('namespace_ibfk_1', 'namespace', type_='foreignkey')
    op.alter_column('namespace', 'imapaccount_id',
                    new_column_name='account_id', existing_type=sa.Integer(),
    # Contact
    op.drop_constraint('contact_ibfk_1', 'contact', type_='foreignkey')
    op.alter_column('contact', 'imapaccount_id',
                    new_column_name='account_id', existing_type=sa.Integer(),
                    existing_nullable=False)
 
    op.drop_constraint('foldersync_ibfk_1', 'foldersync', type_='foreignkey')
    op.alter_column('foldersync', 'imapaccount_id',
                    new_column_name='account_id', existing_type=sa.Integer(),
                    existing_nullable=False)
def downgrade_namespace_contact_foldersync():
    # Namespace
    op.drop_constraint('namespace_ibfk_1', 'namespace', type_='foreignkey')
    op.alter_column('namespace', 'account_id',
                    new_column_name='imapaccount_id',
    # Contact
    op.drop_constraint('contact_ibfk_1', 'contact', type_='foreignkey')
    op.alter_column('contact', 'account_id',
                    new_column_name='imapaccount_id',
                    existing_type=sa.Integer(),

src/i/n/inbox-HEAD/migrations/versions/009_multiple_contact_providers.py   inbox(Download)
def upgrade():
    op.add_column('contact', sa.Column('provider_name', sa.String(length=64),
                                       nullable=False))
    op.alter_column('contact', 'g_id', new_column_name='uid', nullable=False,
                    existing_type=sa.String(length=64))
def downgrade():
    op.alter_column('contact', 'uid', new_column_name='g_id',
                    existing_type=sa.String(length=64), existing_nullable=True)
    op.drop_column('contact', 'provider_name')
    op.drop_constraint('uid', 'contact', type_='unique')

src/i/a/iati-datastore-HEAD/alembic/versions/3dd506d98d0_add_provider_fields.py   iati-datastore(Download)
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('budget', u'value_amount', existing_type=sa.INTEGER(), 
                    type_=sa.NUMERIC(), nullable=False)
 
    op.add_column('transaction', sa.Column('receiver_org_text', sa.Unicode(),
                   nullable=True))
    op.alter_column('transaction', 'value_amount', existing_type=sa.INTEGER(),
                    type_=sa.NUMERIC(), nullable=False)
    op.add_column('transaction', sa.Column('provider_org_activity_id',
    op.drop_column('transaction', 'receiver_org_ref')
    op.drop_column('transaction', 'receiver_org_activity_id')
    op.alter_column('budget', u'value_amount',
               existing_type=sa.NUMERIC(),
               type_=sa.INTEGER(),
               nullable=True)
    op.alter_column('transaction', u'value_amount',

src/c/u/cuckoo-HEAD/utils/db_migration/versions/from_0_6_to_1_1.py   cuckoo(Download)
            conn.execute("update tasks set clock=added_on")
            # Add the not null constraint.
            op.alter_column("tasks", "clock", nullable=False, existing_nullable=True)
            # Altering status ENUM.
            # This shit of raw SQL is here because alembic doesn't deal well with alter_colum of ENUM type.
            conn.execute("update tasks set clock=added_on")
            # Add the not null constraint.
            op.alter_column("tasks", "clock", nullable=False, existing_nullable=True, existing_type=sa.DateTime(timezone=False))
            # NOTE: To workaround limitations in Alembic and MySQL ALTER statement (cannot remove item from ENUM).
            # Read data.

src/t/o/tokenserver-HEAD/tokenserver/assignment/sqlnode/migrations/versions/6569dd9a060_populate_nodeid_column_and_index.py   tokenserver(Download)
    # Set the column non-nullable so it doesn't mask bugs in the future.
    op.alter_column(
        'users', 'nodeid',
        nullable=False,
        existing_type=sa.BigInteger(),
def downgrade():
    op.drop_index('node_idx', 'users')
    op.alter_column(
        'users', 'nodeid',
        nullable=True,

src/s/t/stalker-0.2.7.2/alembic/versions/433d9caaafab_task_review_status_workflow.py   stalker(Download)
    # alter column to be nullable false
    op.alter_column(
        u'Task_Dependencies',
        'dependency_target',
        existing_nullable=True,
 
    op.alter_column(
        u'Task_Dependencies',
        'depends_to_task_id',
        new_column_name='depends_to_id'
    # alter column to be nullable false
    op.alter_column(
        u'Task_Dependencies',
        'gap_constraint',
        existing_nullable=True,
    # alter column to be nullable false
    op.alter_column(
        u'Task_Dependencies',
        'gap_model',
        existing_nullable=True,
    # alter column to be nullable false
    op.alter_column(
        u'Task_Dependencies',
        'gap_timing',
        existing_nullable=True,

src/d/o/domogik-HEAD/src/domogik/install/alembic/versions/43e639a62c8b_upgrade_to_0_4.py   domogik(Download)
    op.add_column(Device.__tablename__, sa.Column('client_id', sa.Unicode(length=80), nullable=False))
    op.drop_column(Device.__tablename__, u'device_usage_id')
    op.alter_column(Device.__tablename__, u'address',
               existing_type=mysql.VARCHAR(length=255),
               nullable=True)
    op.alter_column(PluginConfig.__tablename__, u'`key`',
               existing_type=sa.Unicode(length=30),
               type_=sa.Unicode(length=255))
    op.alter_column(PluginConfig.__tablename__, u'value',
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(u'core_device', u'address',
               existing_type=mysql.VARCHAR(length=255),
               nullable=False)

src/i/n/inbox-HEAD/migrations/versions/026_add_audit_timestamps_to_all_objects.py   inbox(Download)
                 'updated_at': datetime.utcnow()}))
 
        op.alter_column(table_name, 'created_at', existing_type=sa.DateTime(),
                        nullable=False)
        op.alter_column(table_name, 'updated_at', existing_type=sa.DateTime(),

src/k/h/kharcha-HEAD/alembic/versions/342f7d42966_team_model_changes.py   kharcha(Download)
def upgrade():
    op.add_column('users_teams', sa.Column('created_at', sa.DateTime(), nullable=False, server_default=sa.func.now()))
    op.add_column('users_teams', sa.Column('updated_at', sa.DateTime(), nullable=False, server_default=sa.func.now()))
    op.alter_column('users_teams', 'created_at', server_default=None)
    op.alter_column('users_teams', 'updated_at', server_default=None)
    op.alter_column('users_teams', 'team_id',
               existing_type=sa.INTEGER(),
               nullable=False)
    op.alter_column('users_teams', 'user_id',
def downgrade():
    op.drop_index('users_teams_pkey', 'users_teams')
    op.alter_column('users_teams', 'user_id',
               existing_type=sa.INTEGER(),
               nullable=True)

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next