Python sqlalchemy.Enum() Examples
The following are 30
code examples of sqlalchemy.Enum().
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 |
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: 6f7dfb241354_create_opendaylight_preiodic_task_table.py From networking-odl with Apache License 2.0 | 7 votes |
def upgrade(): periodic_table = op.create_table( 'opendaylight_periodic_task', sa.Column('state', sa.Enum(odl_const.PENDING, odl_const.PROCESSING, name='state'), nullable=False), sa.Column('processing_operation', sa.String(70)), sa.Column('task', sa.String(70), primary_key=True), sa.Column('lock_updated', sa.TIMESTAMP, nullable=False, server_default=sa.func.now(), onupdate=sa.func.now()) ) op.bulk_insert(periodic_table, [{'task': 'maintenance', 'state': odl_const.PENDING}, {'task': 'hostconfig', 'state': odl_const.PENDING}])
Example #3
Source File: 5179e99d35a5_add_lock_types.py From pagure with GNU General Public License v2.0 | 7 votes |
def upgrade(): op.create_table( 'project_locks', sa.Column('project_id', sa.Integer, sa.ForeignKey( 'projects.id', onupdate='CASCADE', ondelete='CASCADE' ), nullable=False, primary_key=True ), sa.Column('lock_type', sa.Enum( 'WORKER', name='lock_type_enum' ), nullable=False, primary_key=True ) ) # Add WORKER locks everywhere conn = op.get_bind() conn.execute("""INSERT INTO project_locks (project_id, lock_type) SELECT id, 'WORKER' from projects""")
Example #4
Source File: 0f3bc98edaa0_more_status.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 7 votes |
def upgrade(): agentstatus.create(op.get_bind()) kernelstatus.create(op.get_bind()) op.add_column('agents', sa.Column('lost_at', sa.DateTime(timezone=True), nullable=True)) op.add_column('agents', sa.Column('status', sa.Enum('ALIVE', 'LOST', 'RESTARTING', 'TERMINATED', name='agentstatus'), nullable=False)) op.create_index(op.f('ix_agents_status'), 'agents', ['status'], unique=False) op.add_column('kernels', sa.Column('agent_addr', sa.String(length=128), nullable=False)) op.add_column('kernels', sa.Column('cpu_slot', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('gpu_slot', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('mem_slot', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('repl_in_port', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('repl_out_port', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('stdin_port', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('stdout_port', sa.Integer(), nullable=False)) op.drop_column('kernels', 'allocated_cores') op.add_column('kernels', sa.Column('cpu_set', sa.ARRAY(sa.Integer), nullable=True)) op.add_column('kernels', sa.Column('gpu_set', sa.ARRAY(sa.Integer), nullable=True)) op.alter_column('kernels', column_name='status', type_=sa.Enum(*kernelstatus_choices, name='kernelstatus'), postgresql_using='status::kernelstatus')
Example #5
Source File: 3d560427d776_add_sequence_number_to_journal.py From networking-odl with Apache License 2.0 | 6 votes |
def upgrade(): op.create_table( 'opendaylightjournal_new', sa.Column('seqnum', sa.BigInteger(), primary_key=True, autoincrement=True), sa.Column('object_type', sa.String(36), nullable=False), sa.Column('object_uuid', sa.String(36), nullable=False), sa.Column('operation', sa.String(36), nullable=False), sa.Column('data', sa.PickleType, nullable=True), sa.Column('state', sa.Enum('pending', 'processing', 'failed', 'completed', name='state'), nullable=False, default='pending'), sa.Column('retry_count', sa.Integer, default=0), sa.Column('created_at', sa.DateTime, default=sa.func.now()), sa.Column('last_retried', sa.TIMESTAMP, server_default=sa.func.now(), onupdate=sa.func.now()), )
Example #6
Source File: 5b98cc4af6c9_create_profiles_table.py From commandment with MIT License | 6 votes |
def upgrade(): op.create_table('profiles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('data', sa.LargeBinary(), nullable=True), sa.Column('payload_type', sa.String(), nullable=True), sa.Column('description', sa.Text(), nullable=True), sa.Column('display_name', sa.String(), nullable=True), sa.Column('expiration_date', sa.DateTime(), nullable=True), sa.Column('identifier', sa.String(), nullable=False), sa.Column('organization', sa.String(), nullable=True), sa.Column('uuid', commandment.dbtypes.GUID(), nullable=True), sa.Column('removal_disallowed', sa.Boolean(), nullable=True), sa.Column('version', sa.Integer(), nullable=True), sa.Column('scope', sa.Enum('User', 'System', name='payloadscope'), nullable=True), sa.Column('removal_date', sa.DateTime(), nullable=True), sa.Column('duration_until_removal', sa.BigInteger(), nullable=True), sa.Column('consent_en', sa.Text(), nullable=True), sa.Column('is_encrypted', sa.Boolean(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_profiles_uuid'), 'profiles', ['uuid'], unique=True)
Example #7
Source File: 703dbf02afde_add_journal_maintenance_table.py From networking-odl with Apache License 2.0 | 6 votes |
def upgrade(): maint_table = op.create_table( 'opendaylight_maintenance', sa.Column('id', sa.String(36), primary_key=True), sa.Column('state', sa.Enum(odl_const.PENDING, odl_const.PROCESSING, name='state'), nullable=False), sa.Column('processing_operation', sa.String(70)), sa.Column('lock_updated', sa.TIMESTAMP, nullable=False, server_default=sa.func.now(), onupdate=sa.func.now()) ) # Insert the only row here that is used to synchronize the lock between # different Neutron processes. op.bulk_insert(maint_table, [{'id': uuidutils.generate_uuid(), 'state': odl_const.PENDING}])
Example #8
Source File: 37e242787ae5_opendaylight_neutron_mechanism_driver_.py From networking-odl with Apache License 2.0 | 6 votes |
def upgrade(): op.create_table( 'opendaylightjournal', sa.Column('id', sa.String(36), primary_key=True), sa.Column('object_type', sa.String(36), nullable=False), sa.Column('object_uuid', sa.String(36), nullable=False), sa.Column('operation', sa.String(36), nullable=False), sa.Column('data', sa.PickleType, nullable=True), sa.Column('state', sa.Enum('pending', 'processing', 'failed', 'completed', name='state'), nullable=False, default='pending'), sa.Column('retry_count', sa.Integer, default=0), sa.Column('created_at', sa.DateTime, default=sa.func.now()), sa.Column('last_retried', sa.TIMESTAMP, server_default=sa.func.now(), onupdate=sa.func.now()) )
Example #9
Source File: e5840df9a88a_create_scep_payload_table.py From commandment with MIT License | 6 votes |
def upgrade(): op.create_table('scep_payload', sa.Column('id', sa.Integer(), nullable=False), sa.Column('url', sa.String(), nullable=False), sa.Column('name', sa.String(), nullable=True), sa.Column('subject', commandment.dbtypes.JSONEncodedDict(), nullable=False), sa.Column('challenge', sa.String(), nullable=True), sa.Column('key_size', sa.Integer(), nullable=False), sa.Column('ca_fingerprint', sa.LargeBinary(), nullable=True), sa.Column('key_type', sa.String(), nullable=False), sa.Column('key_usage', sa.Enum('Signing', 'Encryption', 'All', name='keyusage'), nullable=True), sa.Column('subject_alt_name', sa.String(), nullable=True), sa.Column('retries', sa.Integer(), nullable=False), sa.Column('retry_delay', sa.Integer(), nullable=False), sa.Column('certificate_renewal_time_interval', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['id'], ['payloads.id'], ), sa.PrimaryKeyConstraint('id') )
Example #10
Source File: 41b509d10b5e_vpnaas_endpoint_groups.py From neutron-vpnaas with Apache License 2.0 | 6 votes |
def upgrade(): op.create_table( 'vpn_endpoint_groups', sa.Column('id', sa.String(length=36), nullable=False, primary_key=True), sa.Column('tenant_id', sa.String(length=255), index=True), sa.Column('name', sa.String(length=255)), sa.Column('description', sa.String(length=255)), sa.Column('endpoint_type', sa.Enum(constants.SUBNET_ENDPOINT, constants.CIDR_ENDPOINT, constants.VLAN_ENDPOINT, constants.NETWORK_ENDPOINT, constants.ROUTER_ENDPOINT, name='endpoint_type'), nullable=False), ) op.create_table( 'vpn_endpoints', sa.Column('endpoint', sa.String(length=255), nullable=False), sa.Column('endpoint_group_id', sa.String(36), nullable=False), sa.ForeignKeyConstraint(['endpoint_group_id'], ['vpn_endpoint_groups.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('endpoint', 'endpoint_group_id'), )
Example #11
Source File: bb91fb332c36_.py From GeoHealthCheck with MIT License | 6 votes |
def upgrade(): if not alembic_helpers.tables_exist(['recipient']): print('creating Recipient table(s)') # ### commands auto generated by Alembic - please adjust! ### op.create_table('recipient', sa.Column('id', sa.Integer(), nullable=False), sa.Column('channel', sa.Enum('email', 'webhook', name='recipient_channel_types'), nullable=False), sa.Column('location', sa.Text(), nullable=False), sa.PrimaryKeyConstraint('id') ) op.create_table('resourcenotification', sa.Column('resource_id', sa.Integer(), nullable=False), sa.Column('recipient_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['resource_id'], ['resource.identifier'], ), sa.ForeignKeyConstraint(['recipient_id'], ['recipient.id'], ), sa.PrimaryKeyConstraint('resource_id', 'recipient_id') ) # ### end Alembic commands ### else: print('Tables for recipient support already present, will not create them')
Example #12
Source File: alembic_autogenerate_enums.py From alembic-autogenerate-enums with MIT License | 6 votes |
def get_declared_enums(metadata, schema, default): """ Return a dict mapping SQLAlchemy enumeration types to the set of their declared values. :param metadata: ... :param str schema: Schema name (e.g. "public"). :returns dict: { "my_enum": frozenset(["a", "b", "c"]), } """ types = set(column.type for table in metadata.tables.values() for column in table.columns if (isinstance(column.type, sqlalchemy.Enum) and schema == (column.type.schema or default))) return {t.name: frozenset(t.enums) for t in types}
Example #13
Source File: 0d553d59f369_users_replace_is_active_to_status_and_its_info.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 6 votes |
def upgrade(): userstatus.create(op.get_bind()) op.add_column( 'users', sa.Column('status', sa.Enum(*userstatus_choices, name='userstatus'), nullable=True) ) op.add_column('users', sa.Column('status_info', sa.Unicode(), nullable=True)) # Set user's status field. conn = op.get_bind() query = textwrap.dedent( "UPDATE users SET status = 'active', status_info = 'migrated' WHERE is_active = 't';" ) conn.execute(query) query = textwrap.dedent( "UPDATE users SET status = 'inactive', status_info = 'migrated' WHERE is_active <> 't';" ) conn.execute(query) op.alter_column('users', column_name='status', nullable=False) op.drop_column('users', 'is_active')
Example #14
Source File: db_fixtures.py From aiohttp_admin with Apache License 2.0 | 6 votes |
def document_schema(): choices = ['a', 'b', 'c'] schema = t.Dict({ t.Key('_id'): MongoId, t.Key('title'): t.String(max_length=200), t.Key('category'): t.String(max_length=200), t.Key('body'): t.String, t.Key('views'): t.ToInt, t.Key('average_note'): t.ToFloat, # t.Key('pictures'): t.Dict({}).allow_extra('*'), t.Key('published_at'): DateTime, # t.Key('tags'): t.List(t.Int), t.Key('status'): t.Enum(*choices), t.Key('visible'): t.ToBool, }) return schema
Example #15
Source File: 097_add_services.py From designate with Apache License 2.0 | 6 votes |
def upgrade(migrate_engine): meta.bind = migrate_engine status_enum = Enum(name='service_statuses_enum', metadata=meta, *SERVICE_STATES) status_enum.create(checkfirst=True) service_status_table = Table('service_statuses', meta, Column('id', UUID(), default=utils.generate_uuid, primary_key=True), Column('created_at', DateTime), Column('updated_at', DateTime), Column('service_name', String(40), nullable=False), Column('hostname', String(255), nullable=False), Column('heartbeated_at', DateTime, nullable=True), Column('status', status_enum, nullable=False), Column('stats', Text, nullable=False), Column('capabilities', Text, nullable=False), ) service_status_table.create(checkfirst=True)
Example #16
Source File: 26b4c36c11e_create_database.py From spkrepo with MIT License | 6 votes |
def downgrade(): op.drop_table("download") op.drop_table("build_architecture") op.drop_table("displayname") op.drop_table("description") op.drop_table("icon") sa.Enum(name="icon_size").drop(op.get_bind(), checkfirst=False) op.drop_table("build") op.drop_table("version_service_dependency") op.drop_table("package_user_maintainer") with op.batch_alter_table("version", schema=None) as batch_op: batch_op.drop_index(batch_op.f("ix_version_version")) op.drop_table("version") op.drop_table("screenshot") op.drop_table("user_role") op.drop_table("package") op.drop_table("service") op.drop_table("firmware") op.drop_table("language") op.drop_table("architecture") op.drop_table("role") op.drop_table("user")
Example #17
Source File: cd5cb44c8f7c_.py From SempoBlockchain with GNU General Public License v3.0 | 6 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('fiat_ramp', sa.Column('id', sa.Integer(), nullable=False), sa.Column('authorising_user_id', sa.Integer(), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('updated', sa.DateTime(), nullable=True), sa.Column('_payment_method', sa.String(), nullable=True), sa.Column('payment_amount', sa.Integer(), nullable=True), sa.Column('payment_reference', sa.String(), nullable=True), sa.Column('payment_status', sa.Enum('PENDING', 'FAILED', 'COMPLETE', name='fiatrampstatusenum'), nullable=True), sa.Column('credit_transfer_id', sa.Integer(), nullable=True), sa.Column('token_id', sa.Integer(), nullable=True), sa.Column('payment_metadata', postgresql.JSONB(astext_type=sa.Text()), nullable=True), sa.ForeignKeyConstraint(['credit_transfer_id'], ['credit_transfer.id'], ), sa.ForeignKeyConstraint(['token_id'], ['token.id'], ), sa.PrimaryKeyConstraint('id') ) # ### end Alembic commands ###
Example #18
Source File: 4292b00185bf_whitelist.py From packit-service with MIT License | 6 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "whitelist", sa.Column("id", sa.Integer(), nullable=False), sa.Column("account_name", sa.String(), nullable=True), sa.Column( "status", sa.Enum( "approved_automatically", "waiting", "approved_manually", name="whiteliststatus", ), nullable=True, ), sa.PrimaryKeyConstraint("id"), ) op.create_index( op.f("ix_whitelist_account_name"), "whitelist", ["account_name"], unique=False ) # ### end Alembic commands ###
Example #19
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_enum_detection(metadata): Table("simple_items", metadata, Column("enum", VARCHAR(255)), CheckConstraint(r"simple_items.enum IN ('A', '\'B', 'C')")) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Column, Enum, MetaData, Table metadata = MetaData() t_simple_items = Table( 'simple_items', metadata, Column('enum', Enum('A', "\\\\'B", 'C')) ) """ )
Example #20
Source File: 0e5babc5b9ee_create_vpp_licenses.py From commandment with MIT License | 6 votes |
def schema_upgrades(): """schema upgrade migrations go here.""" op.create_table('vpp_licenses', sa.Column('license_id', sa.Integer(), nullable=False), sa.Column('adam_id', sa.String(), nullable=True), sa.Column('product_type', sa.Enum('Software', 'Application', 'Publication', name='vppproducttype'), nullable=True), sa.Column('product_type_name', sa.String(), nullable=True), sa.Column('pricing_param', sa.Enum('StandardQuality', 'HighQuality', name='vpppricingparam'), nullable=True), sa.Column('is_irrevocable', sa.Boolean(), nullable=True), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('client_user_id', commandment.dbtypes.GUID(), nullable=True), sa.Column('its_id_hash', sa.String(), nullable=True), sa.ForeignKeyConstraint(['client_user_id'], ['vpp_users.client_user_id'], ), sa.ForeignKeyConstraint(['user_id'], ['vpp_users.user_id'], ), sa.PrimaryKeyConstraint('license_id') )
Example #21
Source File: 0032_notification_created_status.py From notifications-api with MIT License | 6 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### status_type = sa.Enum('created', 'sending', 'delivered', 'pending', 'failed', 'technical-failure', 'temporary-failure', 'permanent-failure', name='notify_status_type') status_type.create(op.get_bind()) op.add_column('notifications', sa.Column('new_status', status_type, nullable=True)) op.execute('update notifications set new_status = CAST(CAST(status as text) as notify_status_type)') op.alter_column('notifications', 'status', new_column_name='old_status') op.alter_column('notifications', 'new_status', new_column_name='status') op.drop_column('notifications', 'old_status') op.get_bind() op.execute('DROP TYPE notify_status_types') op.alter_column('notifications', 'status', nullable=False) ### end Alembic commands ###
Example #22
Source File: 0032_notification_created_status.py From notifications-api with MIT License | 6 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### status_type = sa.Enum('sending', 'delivered', 'pending', 'failed', 'technical-failure', 'temporary-failure', 'permanent-failure', name='notify_status_types') status_type.create(op.get_bind()) op.add_column('notifications', sa.Column('old_status', status_type, nullable=True)) op.execute("update notifications set status = 'sending' where status = 'created'") op.execute('update notifications set old_status = CAST(CAST(status as text) as notify_status_types)') op.alter_column('notifications', 'status', new_column_name='new_status') op.alter_column('notifications', 'old_status', new_column_name='status') op.drop_column('notifications', 'new_status') op.get_bind() op.execute('DROP TYPE notify_status_type') op.alter_column('notifications', 'status', nullable=False) ### end Alembic commands ###
Example #23
Source File: 0022_add_pending_status.py From notifications-api with MIT License | 6 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### status_type = sa.Enum('sending', 'delivered', 'pending', 'failed', 'technical-failure', 'temporary-failure', 'permanent-failure', name='notify_status_types') status_type.create(op.get_bind()) op.add_column('notifications', sa.Column('new_status', status_type, nullable=True)) op.execute('update notifications set new_status = CAST(CAST(status as text) as notify_status_types)') op.alter_column('notifications', 'status', new_column_name='old_status') op.alter_column('notifications', 'new_status', new_column_name='status') op.drop_column('notifications', 'old_status') op.get_bind() op.execute('DROP TYPE notification_status_type') op.alter_column('notifications', 'status', nullable=False) ### end Alembic commands ###
Example #24
Source File: 0022_add_pending_status.py From notifications-api with MIT License | 6 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### status_type = sa.Enum('sending', 'delivered', 'failed', 'technical-failure', 'temporary-failure', 'permanent-failure', name='notification_status_type') status_type.create(op.get_bind()) op.add_column('notifications', sa.Column('old_status', status_type, nullable=True)) op.execute("update notifications set status = 'sending' where status = 'pending'") op.execute('update notifications set old_status = CAST(CAST(status as text) as notification_status_type)') op.alter_column('notifications', 'status', new_column_name='new_status') op.alter_column('notifications', 'old_status', new_column_name='status') op.drop_column('notifications', 'new_status') op.get_bind() op.execute('DROP TYPE notify_status_types') op.alter_column('notifications', 'status', nullable=False) ### end Alembic commands ###
Example #25
Source File: 072fba4a2256_create_ad_payload_table.py From commandment with MIT License | 6 votes |
def upgrade(): op.create_table('ad_payload', sa.Column('id', sa.Integer(), nullable=False), sa.Column('host_name', sa.String(), nullable=False), sa.Column('user_name', sa.String(), nullable=False), sa.Column('password', sa.String(), nullable=False), sa.Column('ad_organizational_unit', sa.String(), nullable=False), sa.Column('ad_mount_style', sa.Enum('AFP', 'SMB', name='admountstyle'), nullable=False), sa.Column('ad_default_user_shell', sa.String(), nullable=True), sa.Column('ad_map_uid_attribute', sa.String(), nullable=True), sa.Column('ad_map_gid_attribute', sa.String(), nullable=True), sa.Column('ad_map_ggid_attribute', sa.String(), nullable=True), sa.Column('ad_preferred_dc_server', sa.String(), nullable=True), sa.Column('ad_domain_admin_group_list', sa.String(), nullable=True), sa.Column('ad_namespace', sa.Enum('Domain', 'Forest', name='adnamespace'), nullable=True), sa.Column('ad_packet_sign', sa.Enum('Allow', 'Disable', 'Require', name='adpacketsignpolicy'), nullable=True), sa.Column('ad_packet_encrypt', sa.Enum('Allow', 'Disable', 'Require', 'SSL', name='adpacketencryptpolicy'), nullable=True), sa.Column('ad_restrict_ddns', sa.String(), nullable=True), sa.Column('ad_trust_change_pass_interval', sa.Integer(), nullable=True), sa.Column('ad_create_mobile_account_at_login', sa.Boolean(), nullable=True), sa.Column('ad_warn_user_before_creating_ma', sa.Boolean(), nullable=True), sa.Column('ad_force_home_local', sa.Boolean(), nullable=True), sa.ForeignKeyConstraint(['id'], ['payloads.id'], ), sa.PrimaryKeyConstraint('id') )
Example #26
Source File: 0005_add_provider_stats.py From notifications-api with MIT License | 6 votes |
def upgrade(): op.create_table('provider_rates', sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('valid_from', sa.DateTime(), nullable=False), sa.Column('provider', sa.Enum('mmg', 'twilio', 'firetext', 'ses', name='providers'), nullable=False), sa.Column('rate', sa.Numeric(), nullable=False), sa.PrimaryKeyConstraint('id') ) op.create_table('provider_statistics', sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('day', sa.Date(), nullable=False), sa.Column('provider', sa.Enum('mmg', 'twilio', 'firetext', 'ses', name='providers'), nullable=False), sa.Column('service_id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('unit_count', sa.BigInteger(), nullable=False), sa.ForeignKeyConstraint(['service_id'], ['services.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_provider_statistics_service_id'), 'provider_statistics', ['service_id'], unique=False)
Example #27
Source File: 323a90039a6a_create_email_payload_table.py From commandment with MIT License | 6 votes |
def upgrade(): op.create_table('email_payload', sa.Column('id', sa.Integer(), nullable=False), sa.Column('email_account_description', sa.String(), nullable=True), sa.Column('email_account_name', sa.String(), nullable=True), sa.Column('email_account_type', sa.Enum('POP', 'IMAP', name='emailaccounttype'), nullable=False), sa.Column('email_address', sa.String(), nullable=True), sa.Column('incoming_auth', sa.Enum('Password', 'CRAM_MD5', 'NTLM', 'HTTP_MD5', 'ENone', name='emailauthenticationtype'), nullable=False), sa.Column('incoming_host', sa.String(), nullable=False), sa.Column('incoming_port', sa.Integer(), nullable=True), sa.Column('incoming_use_ssl', sa.Boolean(), nullable=True), sa.Column('incoming_username', sa.String(), nullable=False), sa.Column('incoming_password', sa.String(), nullable=True), sa.Column('outgoing_password', sa.String(), nullable=True), sa.Column('outgoing_incoming_same', sa.Boolean(), nullable=True), sa.Column('outgoing_auth', sa.Enum('Password', 'CRAM_MD5', 'NTLM', 'HTTP_MD5', 'ENone', name='emailauthenticationtype'), nullable=False), sa.ForeignKeyConstraint(['id'], ['payloads.id'], ), sa.PrimaryKeyConstraint('id') )
Example #28
Source File: 8186b8ecf0fc_create_ad_cert_payload_table.py From commandment with MIT License | 6 votes |
def upgrade(): op.create_table('ad_cert_payload', sa.Column('id', sa.Integer(), nullable=False), sa.Column('certificate_description', sa.String(), nullable=True), sa.Column('allow_all_apps_access', sa.Boolean(), nullable=True), sa.Column('cert_server', sa.String(), nullable=False), sa.Column('cert_template', sa.String(), nullable=False), sa.Column('acquisition_mechanism', sa.Enum('RPC', 'HTTP', name='adcertificateacquisitionmechanism'), nullable=True), sa.Column('certificate_authority', sa.String(), nullable=False), sa.Column('renewal_time_interval', sa.Integer(), nullable=True), sa.Column('identity_description', sa.String(), nullable=True), sa.Column('key_is_extractable', sa.Boolean(), nullable=True), sa.Column('prompt_for_credentials', sa.Boolean(), nullable=True), sa.Column('keysize', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['id'], ['payloads.id'], ), sa.PrimaryKeyConstraint('id') )
Example #29
Source File: d5db24264f5c_add_consistent_snapshot_support_attr_to_share_group_model.py From manila with Apache License 2.0 | 6 votes |
def upgrade(): # Workaround for following alembic bug: # https://bitbucket.org/zzzeek/alembic/issue/89 context = op.get_context() if context.bind.dialect.name == 'postgresql': op.execute( "CREATE TYPE %s AS ENUM ('%s', '%s')" % ( ATTR_NAME, ENUM_POOL_VALUE, ENUM_HOST_VALUE)) op.add_column( SG_TABLE_NAME, sa.Column( ATTR_NAME, sa.Enum(ENUM_POOL_VALUE, ENUM_HOST_VALUE, name=ATTR_NAME), nullable=True, ), )
Example #30
Source File: e3691fc396e9_.py From lemur with Apache License 2.0 | 6 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table( "logs", sa.Column("id", sa.Integer(), nullable=False), sa.Column("certificate_id", sa.Integer(), nullable=True), sa.Column("log_type", sa.Enum("key_view", name="log_type"), nullable=False), sa.Column( "logged_at", sqlalchemy_utils.types.arrow.ArrowType(), server_default=sa.text("now()"), nullable=False, ), sa.Column("user_id", sa.Integer(), nullable=False), sa.ForeignKeyConstraint(["certificate_id"], ["certificates.id"]), sa.ForeignKeyConstraint(["user_id"], ["users.id"]), sa.PrimaryKeyConstraint("id"), ) ### end Alembic commands ###