Python sqlalchemy.dialects.mysql.INTEGER Examples
The following are 30
code examples of sqlalchemy.dialects.mysql.INTEGER().
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.dialects.mysql
, or try the search function
.
Example #1
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_noconstraints_table(metadata): simple_items = Table("simple_items", metadata, Column("number", INTEGER), CheckConstraint("number > 2")) simple_items.indexes.add(Index("idx_number", simple_items.c.number)) assert ( generate_code(metadata, noconstraints=True) == """\ # coding: utf-8 from sqlalchemy import Column, Integer, MetaData, Table metadata = MetaData() t_simple_items = Table( 'simple_items', metadata, Column('number', Integer, index=True) ) """ )
Example #2
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_no_inflect(metadata): Table("simple_items", metadata, Column("id", INTEGER, primary_key=True)) assert ( generate_code(metadata, noinflect=True) == """\ # coding: utf-8 from sqlalchemy import Column, Integer from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata class SimpleItems(Base): __tablename__ = 'simple_items' id = Column(Integer, primary_key=True) """ )
Example #3
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_no_classes(metadata): Table("simple_items", metadata, Column("id", INTEGER, primary_key=True)) assert ( generate_code(metadata, noclasses=True) == """\ # coding: utf-8 from sqlalchemy import Column, Integer, MetaData, Table metadata = MetaData() t_simple_items = Table( 'simple_items', metadata, Column('id', Integer, primary_key=True) ) """ )
Example #4
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_table_kwargs(metadata): Table("simple_items", metadata, Column("id", INTEGER, primary_key=True), schema="testschema") assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Column, Integer from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata class SimpleItem(Base): __tablename__ = 'simple_items' __table_args__ = {'schema': 'testschema'} id = Column(Integer, primary_key=True) """ )
Example #5
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_schema_boolean(metadata): Table( "simple_items", metadata, Column("bool1", INTEGER), CheckConstraint("testschema.simple_items.bool1 IN (0, 1)"), schema="testschema" ) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Boolean, Column, MetaData, Table metadata = MetaData() t_simple_items = Table( 'simple_items', metadata, Column('bool1', Boolean), schema='testschema' ) """ )
Example #6
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_pk_default(metadata): Table("simple_items", metadata, Column("id", INTEGER, primary_key=True, server_default=text("uuid_generate_v4()"))) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Column, Integer, text from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata class SimpleItem(Base): __tablename__ = 'simple_items' id = Column(Integer, primary_key=True, server_default=text("uuid_generate_v4()")) """ )
Example #7
Source File: 057d794890a4_forks_and_subscribers_count.py From gitmostwanted.com with MIT License | 6 votes |
def upgrade(): op.add_column( 'repos', sa.Column('forks_count', INTEGER(unsigned=True), server_default='0', nullable=False) ) op.add_column( 'repos', sa.Column('open_issues_count', INTEGER(unsigned=True), server_default='0', nullable=False) ) op.add_column( 'repos', sa.Column('size', INTEGER(unsigned=True), server_default='0', nullable=False) ) op.add_column( 'repos', sa.Column('subscribers_count', INTEGER(unsigned=True), server_default='0', nullable=False) ) op.create_index(op.f('ix_repos_forks_count'), 'repos', ['forks_count'], unique=False) op.create_index(op.f('ix_repos_stargazers_count'), 'repos', ['stargazers_count'], unique=False) op.create_index( op.f('ix_repos_subscribers_count'), 'repos', ['subscribers_count'], unique=False )
Example #8
Source File: 13b73f6d1082_restructuring_vulnerability_pk_and_.py From vulncode-db with Apache License 2.0 | 6 votes |
def downgrade(): op.drop_constraint('fk_vuln', 'vulnerability_git_commits', type_='foreignkey') op.create_index('uk_ver_cve_id', 'vulnerability', ['version', 'cve_id'], unique=True) op.drop_constraint('uk_vcdb_id_version', 'vulnerability', type_='unique') op.drop_column('vulnerability', 'vcdb_id') op.drop_column('vulnerability', 'prev_version') op.alter_column('vulnerability', 'version', existing_type=mysql.INTEGER(display_width=11), nullable=False) # Drop all foreign keys on vulnerability.id as we intend to update it. op.drop_constraint('vulnerability_git_commits_ibfk_1', 'vulnerability_git_commits', type_='foreignkey') ############## # Update the vulnerability primary key. # Remove autoincrement from the PK as there can only be one auto key and it has to be the PK. op.alter_column('vulnerability', 'id', existing_type=sa.Integer(), autoincrement=False, nullable=False) op.drop_constraint('id', 'vulnerability', type_='primary') # Now we can define a new primary key. op.create_primary_key('pk', 'vulnerability', ['id', 'version']) # Re-enable auto incrementing for the id column, too. op.alter_column('vulnerability', 'id', existing_type=sa.Integer(), autoincrement=True, nullable=False) # ---------------------------------------------------------------------------------------------------- op.add_column('vulnerability_git_commits', sa.Column('version', sa.Integer(), nullable=False)) op.create_foreign_key('fk_vuln', 'vulnerability_git_commits', 'vulnerability', ['vulnerability_details_id', 'version'], ['id', 'version']) # ### end Alembic commands ###
Example #9
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_server_default_double_quotes(metadata): Table("simple", metadata, Column("id", INTEGER, primary_key=True, server_default=text('nextval("foo")'))) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Column, Integer, text from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata class Simple(Base): __tablename__ = 'simple' id = Column(Integer, primary_key=True, server_default=text("nextval(\\"foo\\")")) """ )
Example #10
Source File: 611733367157_adding_new_fields_and_keys_indices_to_.py From vulncode-db with Apache License 2.0 | 6 votes |
def downgrade(): op.drop_constraint('fk_vuln', 'vulnerability_git_commits', type_='foreignkey') op.alter_column('vulnerability_git_commits', 'vulnerability_details_id', existing_type=mysql.INTEGER(display_width=11), nullable=True) op.drop_column('vulnerability_git_commits', 'version') op.drop_index(op.f('ix_vulnerability_cve_id'), table_name='vulnerability') op.drop_constraint('uk_ver_cve_id', 'vulnerability', type_='unique') op.create_index('cve_id', 'vulnerability', ['cve_id'], unique=True) # Remove autoincrement from the PK as there can only be one auto key and it has to be the PK. op.alter_column('vulnerability', 'id', existing_type=sa.Integer(), autoincrement=False, nullable=False) op.drop_constraint('pk', 'vulnerability', type_='primary') op.create_primary_key('id', 'vulnerability', ['id']) op.alter_column('vulnerability', 'id', existing_type=sa.Integer(), autoincrement=True, nullable=False) op.drop_column('vulnerability', 'version') op.drop_column('vulnerability', 'state') op.drop_constraint('fk_reviewer_id', 'vulnerability', type_='foreignkey') op.drop_column('vulnerability', 'reviewer_id') op.drop_column('vulnerability', 'review_feedback') op.add_column('vulnerability_resources', sa.Column('vulnerability_details_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.create_foreign_key('vulnerability_resources_ibfk_1', 'vulnerability_resources', 'vulnerability', ['vulnerability_details_id'], ['id']) op.create_foreign_key('vulnerability_git_commits_ibfk_1', 'vulnerability_git_commits', 'vulnerability', ['vulnerability_details_id'], ['id'])
Example #11
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_indexes_table(metadata): simple_items = Table("simple_items", metadata, Column("id", INTEGER), Column("number", INTEGER), Column("text", VARCHAR)) simple_items.indexes.add(Index("idx_number", simple_items.c.number)) simple_items.indexes.add(Index("idx_text_number", simple_items.c.text, simple_items.c.number, unique=True)) simple_items.indexes.add(Index("idx_text", simple_items.c.text, unique=True)) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Column, Index, Integer, MetaData, String, Table metadata = MetaData() t_simple_items = Table( 'simple_items', metadata, Column('id', Integer), Column('number', Integer, index=True), Column('text', String, unique=True), Index('idx_text_number', 'text', 'number', unique=True) ) """ )
Example #12
Source File: b61e4f6a88cc_del_torrents_info.py From nyaa with GNU General Public License v3.0 | 6 votes |
def downgrade(): op.create_table('nyaa_torrents_info', sa.Column('info_dict', mysql.MEDIUMBLOB(), nullable=True), sa.Column('torrent_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['torrent_id'], ['nyaa_torrents.id'], name='nyaa_torrents_info_ibfk_1', ondelete='CASCADE'), sa.PrimaryKeyConstraint('torrent_id'), mysql_collate='utf8_bin', mysql_default_charset='utf8', mysql_engine='InnoDB', mysql_row_format='COMPRESSED' ) op.create_table('sukebei_torrents_info', sa.Column('info_dict', mysql.MEDIUMBLOB(), nullable=True), sa.Column('torrent_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['torrent_id'], ['sukebei_torrents.id'], name='sukebei_torrents_info_ibfk_1', ondelete='CASCADE'), sa.PrimaryKeyConstraint('torrent_id'), mysql_collate='utf8_bin', mysql_default_charset='utf8', mysql_engine='InnoDB', mysql_row_format='COMPRESSED' )
Example #13
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_pascal(metadata): Table("CustomerAPIPreference", metadata, Column("id", INTEGER, primary_key=True)) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Column, Integer from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata class CustomerAPIPreference(Base): __tablename__ = 'CustomerAPIPreference' id = Column(Integer, primary_key=True) """ )
Example #14
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_mysql_column_types(metadata): Table("simple_items", metadata, Column("id", mysql.INTEGER), Column("name", mysql.VARCHAR(255))) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Column, Integer, MetaData, String, Table metadata = MetaData() t_simple_items = Table( 'simple_items', metadata, Column('id', Integer), Column('name', String(255)) ) """ )
Example #15
Source File: 37e7f6789373_users_table.py From FlaskQuickStart with Apache License 2.0 | 6 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('user', sa.Column('id', sa.Integer(), nullable=False), sa.Column('username', sa.String(length=64), nullable=True), sa.Column('email', sa.String(length=120), nullable=True), sa.Column('password_hash', sa.String(length=128), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True) op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True) op.create_table('post', sa.Column('id', mysql.INTEGER(unsigned=True), nullable=False), sa.Column('body', sa.String(length=140), nullable=True), sa.Column('timestamp', sa.DateTime(), nullable=True), sa.Column('user_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_post_timestamp'), 'post', ['timestamp'], unique=False) # ### end Alembic commands ###
Example #16
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_underscore(metadata): Table("customer_api_preference", metadata, Column("id", INTEGER, primary_key=True)) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Column, Integer from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata class CustomerApiPreference(Base): __tablename__ = 'customer_api_preference' id = Column(Integer, primary_key=True) """ )
Example #17
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_pascal_underscore(metadata): Table("customer_API_Preference", metadata, Column("id", INTEGER, primary_key=True)) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Column, Integer from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata class CustomerAPIPreference(Base): __tablename__ = 'customer_API_Preference' id = Column(Integer, primary_key=True) """ )
Example #18
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_pascal_multiple_underscore(metadata): Table("customer_API__Preference", metadata, Column("id", INTEGER, primary_key=True)) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Column, Integer from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata class CustomerAPIPreference(Base): __tablename__ = 'customer_API__Preference' id = Column(Integer, primary_key=True) """ )
Example #19
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_metadata_column(metadata): Table("simple", metadata, Column("id", INTEGER, primary_key=True), Column("metadata", VARCHAR)) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Column, Integer, String from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata class Simple(Base): __tablename__ = 'simple' id = Column(Integer, primary_key=True) metadata_ = Column('metadata', String) """ )
Example #20
Source File: 5446559aecf7_txnreconcile_txn_id_not_null.py From biweeklybudget with GNU Affero General Public License v3.0 | 6 votes |
def upgrade(): # When making changes to a column that has a foreign key, we need to drop # and then re-add the constraint op.execute('DELETE FROM txn_reconciles WHERE txn_id IS NULL;') op.execute('LOCK TABLES txn_reconciles WRITE, transactions WRITE;') op.drop_constraint('fk_txn_reconciles_txn_id_transactions', 'txn_reconciles', type_='foreignkey') op.alter_column( 'txn_reconciles', 'txn_id', existing_type=mysql.INTEGER(display_width=11), nullable=False ) op.create_foreign_key('fk_txn_reconciles_txn_id_transactions', 'txn_reconciles', 'transactions', ['txn_id'], ['id']) op.execute('UNLOCK TABLES;')
Example #21
Source File: ca9a10db0a21_.py From ok with Apache License 2.0 | 5 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('course', sa.Column('creator_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.create_foreign_key('fk_course_creator_id_user', 'course', 'user', ['creator_id'], ['id']) op.drop_column('course', 'website') ### end Alembic commands ###
Example #22
Source File: 60f68ec8a068_create_general_settings.py From crmint with Apache License 2.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('general_settings', sa.Column('id', mysql.INTEGER(display_width=11), nullable=False), sa.Column('name', mysql.VARCHAR(length=255), nullable=True), sa.Column('value', sa.Text(), nullable=True), sa.Column('created_at', mysql.DATETIME(), nullable=False), sa.Column('updated_at', mysql.DATETIME(), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset=u'utf8', mysql_engine=u'InnoDB' ) # ### end Alembic commands ###
Example #23
Source File: e34417c82307_new_model_to_track_.py From crmint with Apache License 2.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('enqueued_tasks', sa.Column('created_at', mysql.DATETIME(), nullable=False), sa.Column('updated_at', mysql.DATETIME(), nullable=False), sa.Column('id', mysql.INTEGER(display_width=11), nullable=False), sa.Column('task_namespace', mysql.VARCHAR(length=100), nullable=True), sa.Column('task_name', mysql.VARCHAR(length=255), nullable=True), sa.PrimaryKeyConstraint('id'), ) # ### end Alembic commands ###
Example #24
Source File: 95a62f05f603_create_schedules.py From crmint with Apache License 2.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('schedules', sa.Column('created_at', mysql.DATETIME(), nullable=False), sa.Column('updated_at', mysql.DATETIME(), nullable=False), sa.Column('id', mysql.INTEGER(display_width=11), nullable=False), sa.Column('cron', mysql.VARCHAR(length=255), nullable=True), sa.Column('pipeline_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['pipeline_id'], [u'pipelines.id'], name=u'schedules_ibfk_1'), sa.PrimaryKeyConstraint('id'), mysql_default_charset=u'utf8', mysql_engine=u'InnoDB' ) # ### end Alembic commands ###
Example #25
Source File: 2bce993585c_null_corrections_for_repos_and_users.py From gitmostwanted.com with MIT License | 5 votes |
def downgrade(): op.drop_constraint('fk_repos_id', 'users_attitude', type_='foreignkey') op.drop_constraint('fk_users_id', 'users_attitude', type_='foreignkey') op.drop_constraint('ix_github_id', 'users', type_='unique') op.drop_constraint('ix_email', 'users', type_='unique') op.drop_index(op.f('ix_users_attitude_repo_id'), table_name='users_attitude') op.alter_column( 'repos', 'name', existing_type=mysql.VARCHAR(length=80), nullable=True ) op.alter_column( 'repos', 'html_url', existing_type=mysql.VARCHAR(length=150), nullable=True ) op.alter_column( 'repos', 'full_name', existing_type=mysql.VARCHAR(length=120), nullable=True ) op.alter_column( 'report_all_weekly', 'cnt_watch', existing_type=mysql.INTEGER(display_width=11), nullable=True ) op.alter_column( 'report_all_monthly', 'cnt_watch', existing_type=mysql.INTEGER(display_width=11), nullable=True ) op.alter_column( 'report_all_daily', 'cnt_watch', existing_type=mysql.INTEGER(display_width=11), nullable=True )
Example #26
Source File: 044_update_drafts_schema.py From sync-engine with GNU Affero General Public License v3.0 | 5 votes |
def downgrade(): op.add_column('spoolmessage', sa.Column(u'replyto_thread_id', mysql.INTEGER(display_width=11), nullable=True)) op.add_column('spoolmessage', sa.Column(u'draft_copied_from', mysql.INTEGER(display_width=11), nullable=True)) op.drop_column('spoolmessage', 'is_reply') op.create_table( u'draftthread', sa.Column(u'created_at', mysql.DATETIME(), nullable=False), sa.Column(u'updated_at', mysql.DATETIME(), nullable=False), sa.Column(u'deleted_at', mysql.DATETIME(), nullable=True), sa.Column(u'public_id', sa.BINARY(length=16), nullable=False), sa.Column(u'id', mysql.INTEGER(display_width=11), nullable=False), sa.Column(u'master_public_id', sa.BINARY(length=16), nullable=False), sa.Column(u'thread_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.Column(u'message_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['message_id'], [u'message.id'], name=u'draftthread_ibfk_2'), sa.ForeignKeyConstraint(['thread_id'], [u'thread.id'], name=u'draftthread_ibfk_1'), sa.PrimaryKeyConstraint(u'id'), mysql_default_charset=u'utf8mb4', mysql_engine=u'InnoDB' )
Example #27
Source File: 294efa8baade_fdi_additions.py From mma-dexter with Apache License 2.0 | 5 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column(u'investments', sa.Column('involvement_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.drop_constraint(u'investments_ibfk_12', 'investments', type_='foreignkey') op.drop_constraint(u'investments_ibfk_13', 'investments', type_='foreignkey') op.drop_constraint(u'investments_ibfk_14', 'investments', type_='foreignkey') op.drop_constraint(u'investments_ibfk_15', 'investments', type_='foreignkey') op.drop_index(op.f('ix_investments_province_id'), table_name='investments') op.drop_index(op.f('ix_investments_phase_date'), table_name='investments') op.drop_index(op.f('ix_investments_involvement_id3'), table_name='investments') op.drop_index(op.f('ix_investments_involvement_id2'), table_name='investments') op.drop_index(op.f('ix_investments_involvement_id1'), table_name='investments') op.drop_column(u'investments', 'target_market') op.drop_column(u'investments', 'soc_programs') op.drop_column(u'investments', 'province_id') op.drop_column(u'investments', 'phase_date') op.drop_column(u'investments', 'mot_investment') op.drop_column(u'investments', 'involvement_id3') op.drop_column(u'investments', 'involvement_id2') op.drop_column(u'investments', 'involvement_id1') op.drop_column(u'investments', 'gov_programs') op.create_table('involvements', sa.Column('id', mysql.INTEGER(display_width=11), nullable=False), sa.Column('name', mysql.VARCHAR(length=50), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_default_charset=u'latin1', mysql_engine=u'InnoDB' ) op.create_foreign_key(u'investments_ibfk_9', 'investments', 'involvements', ['involvement_id'], ['id']) op.create_index('ix_investments_involvement_id', 'investments', ['involvement_id'], unique=False) op.drop_index(op.f('ix_provinces_name'), table_name='provinces') op.drop_table('provinces') op.drop_index(op.f('ix_involvements3_name'), table_name='involvements3') op.drop_table('involvements3') op.drop_index(op.f('ix_involvements2_name'), table_name='involvements2') op.drop_table('involvements2') op.drop_index(op.f('ix_involvements1_name'), table_name='involvements1') op.drop_table('involvements1') ### end Alembic commands ###
Example #28
Source File: 41b4133d687e_remove_legacy_analysis_nature_links.py From mma-dexter with Apache License 2.0 | 5 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('source_roles', sa.Column('analysis_nature_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) op.create_foreign_key(u'source_roles_ibfk_1', 'source_roles', 'analysis_natures', ['analysis_nature_id'], ['id']) op.add_column('issues', sa.Column('analysis_nature_id', mysql.INTEGER(display_width=11), server_default=sa.text(u"'1'"), autoincrement=False, nullable=True)) op.create_foreign_key(u'issues_ibfk_1', 'issues', 'analysis_natures', ['analysis_nature_id'], ['id']) ### end Alembic commands ###
Example #29
Source File: 437e0ac0a455_.py From mma-dexter with Apache License 2.0 | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_index('ix_affiliations_code', 'affiliations', ['code'], unique=False) op.create_index('ix_affiliations_country_id', 'affiliations', ['country_id'], unique=False) op.create_index('ix_affiliations_name', 'affiliations', ['name'], unique=False) op.drop_index('ix_individuals_name', table_name='affiliations') op.alter_column('document_entities', 'doc_id', existing_type=mysql.INTEGER(display_width=11), nullable=False) op.create_index('ix_document_fairness_bias_favour_affiliation_id', 'document_fairness', ['bias_favour_affiliation_id'], unique=False) op.create_index('ix_document_fairness_bias_oppose_affiliation_id', 'document_fairness', ['bias_oppose_affiliation_id'], unique=False) op.drop_index('ix_document_fairness_bias_favour_individual_id', table_name='document_fairness') op.drop_index('ix_document_fairness_bias_oppose_individual_id', table_name='document_fairness') op.create_index('ix_document_places_relevant', 'document_places', ['relevant'], unique=False) op.create_index('ix_document_sources_affiliation_id', 'document_sources', ['affiliation_id'], unique=False) op.create_index('ix_document_sources_person_id', 'document_sources', ['person_id'], unique=False) op.drop_constraint(u'document_sources_ibfk_2', 'document_sources', type_='foreignkey') op.drop_constraint(u'documents_ibfk_6', 'documents', type_='foreignkey') op.drop_index('ix_document_sources_entity_id', table_name='document_sources') op.drop_column('document_sources', 'entity_id') op.alter_column('documents', 'origin_location_Id', new_column_name='origin_location_id', existing_type=mysql.INTEGER(display_width=11)) op.drop_index('origin_location_Id', table_name='documents') op.create_index('ix_documents_analysis_nature_id', 'documents', ['analysis_nature_id'], unique=False) op.create_index('ix_documents_author_id', 'documents', ['author_id'], unique=False) op.create_index('ix_documents_checked_by_user_id', 'documents', ['checked_by_user_id'], unique=False) op.create_index('ix_documents_country_id', 'documents', ['country_id'], unique=False) op.create_index('ix_documents_created_by_user_id', 'documents', ['created_by_user_id'], unique=False) op.create_index('ix_documents_document_type_id', 'documents', ['document_type_id'], unique=False) op.create_index('ix_documents_flagged', 'documents', ['flagged'], unique=False) op.create_index('ix_documents_medium_id', 'documents', ['medium_id'], unique=False) op.create_index('ix_documents_origin_location_id', 'documents', ['origin_location_id'], unique=False) op.create_index('ix_documents_section', 'documents', ['section'], unique=False) op.create_index('ix_documents_topic_id', 'documents', ['topic_id'], unique=False) op.create_foreign_key(None, 'documents', 'locations', ['origin_location_id'], ['id']) op.create_foreign_key(None, 'issues', 'analysis_natures', ['analysis_nature_id'], ['id']) op.create_index('ix_locations_country_id', 'locations', ['country_id'], unique=False) op.create_index('ix_mediums_country_id', 'mediums', ['country_id'], unique=False) op.create_index('ix_mediums_domain', 'mediums', ['domain'], unique=False) op.create_index('ix_topics_analysis_nature_id', 'topics', ['analysis_nature_id'], unique=False) ### end Alembic commands ###
Example #30
Source File: 22cca3f625d6_topic_analysis_nature_can_be_null.py From mma-dexter with Apache License 2.0 | 5 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.execute("update topics set analysis_nature_id = 1 where analysis_nature_id is null") op.alter_column('topics', 'analysis_nature_id', existing_type=mysql.INTEGER(display_width=11), nullable=False, existing_server_default=sa.text(u"'1'")) ### end Alembic commands ###