Python sqlalchemy.Boolean() Examples

The following are 30 code examples of sqlalchemy.Boolean(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sqlalchemy , or try the search function .
Example #1
Source File: d2aafa234374_create_error_logs_table.py    From backend.ai-manager with GNU Lesser General Public License v3.0 8 votes vote down vote up
def upgrade():
    op.create_table(
        'error_logs',
        IDColumn(),
        sa.Column('created_at', sa.DateTime(timezone=True),
                  server_default=sa.func.now(), index=True),
        sa.Column('severity', sa.Enum('critical', 'error', 'warning', 'info', 'debug', name='errorlog_severity'),
                  index=True),
        sa.Column('source', sa.String),
        sa.Column('user', GUID, sa.ForeignKey('users.uuid'), nullable=True, index=True),
        sa.Column('is_read', sa.Boolean, default=False, index=True),
        sa.Column('is_cleared', sa.Boolean, default=False, index=True),
        sa.Column('message', sa.Text),
        sa.Column('context_lang', sa.String),
        sa.Column('context_env', postgresql.JSONB()),
        sa.Column('request_url', sa.String, nullable=True),
        sa.Column('request_status', sa.Integer, nullable=True),
        sa.Column('traceback', sa.Text, nullable=True),
    ) 
Example #2
Source File: 1d18843a1994_add_is_fork_column_to_projects.py    From pagure with GNU General Public License v2.0 6 votes vote down vote up
def upgrade():
    ''' Add is_fork column to project table'''

    op.add_column(
        'projects',
        sa.Column(
            'is_fork', sa.Boolean,
            default=False,
            nullable=True)
    )

    op.execute('''UPDATE "projects" '''
               '''SET is_fork=TRUE WHERE parent_id IS NOT NULL;''')
    op.execute('''UPDATE "projects" '''
               '''SET is_fork=FALSE WHERE parent_id IS NULL;''')

    op.alter_column(
        'projects', 'is_fork',
        nullable=False, existing_nullable=True) 
Example #3
Source File: 33cdd98bb9b2_split_volume_mapping_table.py    From zun with Apache License 2.0 6 votes vote down vote up
def create_volume_table():
    op.create_table(
        'volume',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('uuid', sa.String(36), nullable=False),
        sa.Column('project_id', sa.String(length=255), nullable=True),
        sa.Column('user_id', sa.String(length=255), nullable=True),
        sa.Column('cinder_volume_id', sa.String(36), nullable=True),
        sa.Column('volume_provider', sa.String(36), nullable=False),
        sa.Column('connection_info', MediumText(), nullable=True),
        sa.Column('host', sa.String(length=255), nullable=True),
        sa.Column('auto_remove', sa.Boolean(), default=False, nullable=True),
        sa.Column('contents', MediumText(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('uuid', name='uniq_volume0uuid'),
    ) 
Example #4
Source File: c6e7fc37ad42_.py    From app with MIT License 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('client_user', sa.Column('default_avatar', sa.Boolean(), server_default='0', nullable=False))
    op.add_column('client_user', sa.Column('name', sa.String(length=128), server_default=sa.text('NULL'), nullable=True))
    op.add_column('gen_email', sa.Column('custom', sa.Boolean(), server_default='0', nullable=False))
    # ### end Alembic commands ### 
Example #5
Source File: 2020_021023_6664d75ce3d4_.py    From app with MIT License 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('mailbox',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
    sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=256), nullable=False),
    sa.Column('verified', sa.Boolean(), nullable=False),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email')
    )
    op.add_column('gen_email', sa.Column('mailbox_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'gen_email', 'mailbox', ['mailbox_id'], ['id'], ondelete='cascade')
    # ### end Alembic commands ### 
Example #6
Source File: d295f8dcfa64_initial_revision.py    From maubot with GNU Affero General Public License v3.0 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('client',
    sa.Column('id', sa.String(length=255), nullable=False),
    sa.Column('homeserver', sa.String(length=255), nullable=False),
    sa.Column('access_token', sa.Text(), nullable=False),
    sa.Column('enabled', sa.Boolean(), nullable=False),
    sa.Column('next_batch', sa.String(length=255), nullable=False),
    sa.Column('filter_id', sa.String(length=255), nullable=False),
    sa.Column('sync', sa.Boolean(), nullable=False),
    sa.Column('autojoin', sa.Boolean(), nullable=False),
    sa.Column('displayname', sa.String(length=255), nullable=False),
    sa.Column('avatar_url', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('plugin',
    sa.Column('id', sa.String(length=255), nullable=False),
    sa.Column('type', sa.String(length=255), nullable=False),
    sa.Column('enabled', sa.Boolean(), nullable=False),
    sa.Column('primary_user', sa.String(length=255), nullable=False),
    sa.Column('config', sa.Text(), nullable=False),
    sa.ForeignKeyConstraint(['primary_user'], ['client.id'], onupdate='CASCADE', ondelete='RESTRICT'),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ### 
Example #7
Source File: d2affd5b4172_add_auto_remove_to_volume_mapping.py    From zun with Apache License 2.0 6 votes vote down vote up
def upgrade():
    op.add_column('volume_mapping',
                  sa.Column('auto_remove', sa.Boolean, nullable=True)) 
Example #8
Source File: d4d2c5aa8a0_add_granularity_to_watching_repos.py    From pagure with GNU General Public License v2.0 6 votes vote down vote up
def upgrade():
    op.add_column('watchers', sa.Column('watch_commits', sa.Boolean(),
                                        nullable=True))
    op.add_column('watchers', sa.Column('watch_issues', sa.Boolean(),
                                        nullable=True))
    # This section is to update the `watch_issues` and `watch_commits` columns
    # with the value of `watch`
    connection = op.get_bind()
    for watcher in connection.execute(watcher_helper.select()):
        connection.execute(
            watcher_helper.update().where(
                watcher_helper.c.id == watcher.id
            ).values(
                watch_issues=watcher.watch,
                watch_commits=False
            )
        )

    with op.batch_alter_table('watchers') as b:
        # Set nullable to False now that we've set values
        b.alter_column('watch_issues', nullable=False)
        b.alter_column('watch_commits', nullable=False)
        # Remove the watch column
        b.drop_column('watch') 
Example #9
Source File: ce209920f654_create_task_template_table.py    From backend.ai-manager with GNU Lesser General Public License v3.0 6 votes vote down vote up
def upgrade():
    op.create_table(
        'session_templates',
        IDColumn('id'),
        sa.Column('created_at', sa.DateTime(timezone=True),
                  server_default=sa.func.now(), index=True),
        sa.Column('is_active', sa.Boolean, default=True),
        sa.Column('type',
                  sa.Enum('TASK', 'CLUSTER', name='templatetypes'),
                  nullable=False,
                  server_default='TASK'
                  ),
        sa.Column('domain_name', sa.String(length=64), sa.ForeignKey('domains.name'), nullable=False),
        sa.Column('group_id', GUID, sa.ForeignKey('groups.id'), nullable=True),
        sa.Column('user_uuid', GUID, sa.ForeignKey('users.uuid'), nullable=False),

        sa.Column('name', sa.String(length=128), nullable=True),
        sa.Column('template', sa.String(length=16 * 1024), nullable=False)
    )
    op.add_column(
        'kernels',
        sa.Column('bootstrap_script', sa.String(length=4 * 1024), nullable=True)
    ) 
Example #10
Source File: eab41ce5f92a_add_active_commit_attribute_to_the_hook_.py    From pagure with GNU General Public License v2.0 6 votes vote down vote up
def upgrade():
    ''' Add active_commit column to hook_pagure_ci table'''
    op.add_column(
        'hook_pagure_ci',
        sa.Column('active_commit', sa.Boolean, nullable=True, default=False)
    )
    op.add_column(
        'hook_pagure_ci',
        sa.Column('active_pr', sa.Boolean, nullable=True, default=False)
    )
    op.execute('UPDATE hook_pagure_ci SET active_pr=active')
    op.execute('UPDATE hook_pagure_ci SET active_commit=False')
    op.alter_column(
        'hook_pagure_ci', 'active_pr',
        nullable=False, existing_nullable=True)
    op.alter_column(
        'hook_pagure_ci', 'active_commit',
        nullable=False, existing_nullable=True) 
Example #11
Source File: 3237fc64b306_read_only_mode_in_projects.py    From pagure with GNU General Public License v2.0 6 votes vote down vote up
def upgrade():
    ''' Add a column to mark a project read only '''
    op.add_column(
        'projects',
        sa.Column(
            'read_only',
            sa.Boolean,
            default=True,
            nullable=True,
        )
    )
    op.execute(''' UPDATE projects SET read_only=False ''')
    op.alter_column(
        'projects',
        'read_only',
        nullable=False,
        existing_nullable=True
    ) 
Example #12
Source File: 9e1b06b9df13_.py    From app with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('custom_domain', sa.Column('dkim_verified', sa.Boolean(), server_default='0', nullable=False))
    # ### end Alembic commands ### 
Example #13
Source File: 22db0a833d35_add_notifications_to_tickets.py    From pagure with GNU General Public License v2.0 5 votes vote down vote up
def upgrade():
    ''' Add the column notification to the table issue_comments.
    '''
    op.add_column(
        'issue_comments',
        sa.Column('notification', sa.Boolean, default=False, nullable=True)
    )
    op.execute('''UPDATE "issue_comments" SET notification=False;''')
    op.alter_column(
        'issue_comments', 'notification',
        nullable=False, existing_nullable=True) 
Example #14
Source File: 4255158a6913_create_private_column_in_project_table.py    From pagure with GNU General Public License v2.0 5 votes vote down vote up
def upgrade():
    ''' Add a private column in the project table
    '''
    op.add_column(
        'projects',
        sa.Column('private', sa.Boolean, nullable=True, default=False)
    )
    op.execute('''UPDATE "projects" '''
               '''SET private=False;''')

    op.alter_column(
        'projects',
        column_name='private',
        nullable=False, existing_nullable=True) 
Example #15
Source File: 11470abae0d6_add_key_notify_to_issue_keys.py    From pagure with GNU General Public License v2.0 5 votes vote down vote up
def upgrade():
    ''' Add a column to record if the custom field should trigger a email
    notification.
    '''
    op.add_column(
        'issue_keys',
        sa.Column(
            'key_notify', sa.Boolean, default=False, nullable=True
        )
    )
    op.execute('UPDATE issue_keys SET key_notify=False')
    op.alter_column(
        'issue_keys', 'key_notify',
        nullable=False, existing_nullable=True) 
Example #16
Source File: d7589827abbb_add_support_for_allow_rebase.py    From pagure with GNU General Public License v2.0 5 votes vote down vote up
def upgrade():
    ''' Add the column allow_rebase to the table pull_requests.
    '''
    op.add_column(
        'pull_requests',
        sa.Column('allow_rebase', sa.Boolean, default=False, nullable=True)
    )
    op.execute('''UPDATE pull_requests SET allow_rebase=False;''')
    op.alter_column(
        'pull_requests', 'allow_rebase', existing_type=sa.Boolean,
        nullable=False, existing_nullable=True) 
Example #17
Source File: 0f0bd1e9444e_.py    From Penny-Dreadful-Tools with GNU General Public License v3.0 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('match', sa.Column('has_unexpected_third_game', sa.Boolean(), nullable=True))
    op.add_column('match', sa.Column('is_league', sa.Boolean(), nullable=True))
    op.add_column('match', sa.Column('is_tournament', sa.Boolean(), nullable=True))
    # ### end Alembic commands ### 
Example #18
Source File: 3152492b110b_added_staging_area_column.py    From rucio with Apache License 2.0 5 votes vote down vote up
def upgrade():
    '''
    Upgrade the database to this revision
    '''

    schema = context.get_context().version_table_schema + '.' if context.get_context().version_table_schema else ''

    if context.get_context().dialect.name == 'oracle':
        add_column('rses', sa.Column('staging_area', sa.Boolean(name='RSE_STAGING_AREA_CHK'), default=False))
        drop_constraint('REQUESTS_TYPE_CHK', 'requests', type_='check')
        create_check_constraint(constraint_name='REQUESTS_TYPE_CHK', table_name='requests',
                                condition="request_type in ('U', 'D', 'T', 'I', '0')")

    elif context.get_context().dialect.name == 'postgresql':
        add_column('rses', sa.Column('staging_area', sa.Boolean(name='RSE_STAGING_AREA_CHK'), default=False), schema=schema[:-1])
        drop_constraint('REQUESTS_TYPE_CHK', 'requests', type_='check')
        create_check_constraint(constraint_name='REQUESTS_TYPE_CHK', table_name='requests',
                                condition="request_type in ('U', 'D', 'T', 'I', '0')")

    elif context.get_context().dialect.name == 'mysql' and context.get_context().dialect.server_version_info[0] == 5:
        add_column('rses', sa.Column('staging_area', sa.Boolean(name='RSE_STAGING_AREA_CHK'), default=False), schema=schema[:-1])
        create_check_constraint(constraint_name='REQUESTS_TYPE_CHK', table_name='requests',
                                condition="request_type in ('U', 'D', 'T', 'I', '0')")

    elif context.get_context().dialect.name == 'mysql' and context.get_context().dialect.server_version_info[0] == 8:
        add_column('rses', sa.Column('staging_area', sa.Boolean(name='RSE_STAGING_AREA_CHK'), default=False), schema=schema[:-1])
        op.execute('ALTER TABLE ' + schema + 'requests DROP CHECK REQUESTS_TYPE_CHK')  # pylint: disable=no-member
        create_check_constraint(constraint_name='REQUESTS_TYPE_CHK', table_name='requests',
                                condition="request_type in ('U', 'D', 'T', 'I', '0')") 
Example #19
Source File: 2020_051712_659d979b64ce_.py    From app with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('alias', sa.Column('disable_pgp', sa.Boolean(), server_default='0', nullable=False))
    # ### end Alembic commands ### 
Example #20
Source File: 2020_032223_67c61eead8d2_.py    From app with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('contact', sa.Column('is_cc', sa.Boolean(), server_default='0', nullable=False))
    # ### end Alembic commands ### 
Example #21
Source File: 80176413d8aa_keypairs_get_is_admin.py    From backend.ai-manager with GNU Lesser General Public License v3.0 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('keypairs', sa.Column('is_admin', sa.Boolean(), nullable=False, default=False, server_default=false()))
    op.create_index(op.f('ix_keypairs_is_admin'), 'keypairs', ['is_admin'], unique=False)
    # ### end Alembic commands ### 
Example #22
Source File: 2020_041313_bfd7b2302903_.py    From app with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('users', sa.Column('intro_shown', sa.Boolean(), server_default='0', nullable=False))
    # ### end Alembic commands ### 
Example #23
Source File: 2020_030813_628a5438295c_.py    From app with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('mailbox', sa.Column('pgp_finger_print', sa.String(length=512), nullable=True))
    op.add_column('mailbox', sa.Column('pgp_public_key', sa.Text(), nullable=True))
    op.add_column('users', sa.Column('can_use_pgp', sa.Boolean(), server_default='0', nullable=False))
    # ### end Alembic commands ### 
Example #24
Source File: 4a640c170d02_.py    From app with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('subscription',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
    sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
    sa.Column('cancel_url', sa.String(length=1024), nullable=False),
    sa.Column('update_url', sa.String(length=1024), nullable=False),
    sa.Column('subscription_id', sa.String(length=1024), nullable=False),
    sa.Column('event_time', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
    sa.Column('next_bill_date', sa.Date(), nullable=False),
    sa.Column('cancelled', sa.Boolean(), nullable=False),
    sa.Column('plan', sa.Enum('monthly', 'yearly', name='planenum2'), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('subscription_id'),
    sa.UniqueConstraint('user_id')
    )
    op.add_column('users', sa.Column('trial_expiration', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True))
    op.drop_column('users', 'plan_expiration')
    op.drop_column('users', 'plan')
    op.drop_column('users', 'promo_codes')
    # ### end Alembic commands ### 
Example #25
Source File: 6bbda4685999_.py    From app with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('forward_email_log',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
    sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
    sa.Column('forward_id', sa.Integer(), nullable=False),
    sa.Column('is_reply', sa.Boolean(), nullable=False),
    sa.Column('blocked', sa.Boolean(), nullable=False),
    sa.ForeignKeyConstraint(['forward_id'], ['forward_email.id'], ondelete='cascade'),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ### 
Example #26
Source File: 2019_123000_a8b996f0be40_.py    From app with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('users', sa.Column('notification', sa.Boolean(), server_default='1', nullable=False))
    # ### end Alembic commands ### 
Example #27
Source File: 2020_022212_3fa3a648c8e7_.py    From app with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('forward_email_log', sa.Column('bounced', sa.Boolean(), server_default='0', nullable=False))
    # ### end Alembic commands ### 
Example #28
Source File: 2020_051710_c31cdf879ee3_.py    From app with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('recovery_code',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
    sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('code', sa.String(length=16), nullable=False),
    sa.Column('used', sa.Boolean(), nullable=False),
    sa.Column('used_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user_id', 'code', name='uq_recovery_code')
    )
    # ### end Alembic commands ### 
Example #29
Source File: 2020_022314_903ec5f566e8_.py    From app with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('mailbox', sa.Column('new_email', sa.String(length=256), nullable=True))
    op.create_unique_constraint(None, 'mailbox', ['new_email'])
    op.add_column('users', sa.Column('full_mailbox', sa.Boolean(), server_default='0', nullable=False))
    # ### end Alembic commands ### 
Example #30
Source File: 32d7cc46df4_.py    From comport with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('demographic_values',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('department_id', sa.Integer(), nullable=False),
    sa.Column('race', sa.String(length=255), nullable=True),
    sa.Column('gender', sa.String(length=255), nullable=True),
    sa.Column('count', sa.Integer(), nullable=True),
    sa.Column('department_value', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['department_id'], ['departments.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ###