def upgrade():
    conn = op.get_bind()
    if conn.dialect.name == "mysql":
        col_ti_execution_date_type = mysql.TIMESTAMP(fsp=6)
    elif conn.dialect.name in ("sqlite", "mssql"):
        col_ti_execution_date_type = airflow.utils.sqlalchemy.UtcDateTime(
            timezone=True)
    else:
        col_ti_execution_date_type = sa.TIMESTAMP(timezone=True)
    op.create_table(
        'ergo_task', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('task_id', sa.String(length=128), nullable=False),
        sa.Column('request_data', sa.Text(), nullable=True),
        sa.Column('state', sa.String(length=20), nullable=False),
        sa.Column('created_at',
                  airflow.utils.sqlalchemy.UtcDateTime(timezone=True),
                  nullable=False),
        sa.Column('updated_at',
                  airflow.utils.sqlalchemy.UtcDateTime(timezone=True),
                  nullable=False),
        sa.Column('ti_task_id', sa.String(length=250), nullable=False),
        sa.Column('ti_dag_id', sa.String(length=250), nullable=False),
        sa.Column('ti_execution_date',
                  col_ti_execution_date_type,
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['ti_task_id', 'ti_dag_id', 'ti_execution_date'], [
                'task_instance.task_id', 'task_instance.dag_id',
                'task_instance.execution_date'
            ],
            ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_ergo_task_created_at'),
                    'ergo_task', ['created_at'],
                    unique=False)
    op.create_index(op.f('ix_ergo_task_updated_at'),
                    'ergo_task', ['updated_at'],
                    unique=False)
    op.create_table(
        'ergo_job', sa.Column('id', sa.String(length=128), nullable=False),
        sa.Column('task_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(['task_id'], ['ergo_task.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_ergo_job_task_id'),
                    'ergo_job', ['task_id'],
                    unique=True)
コード例 #2
0
def downgrade():   # noqa: D103
    conn = op.get_bind()

    op.create_table(
        'users',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('username', sa.String(length=250), nullable=True),
        sa.Column('email', sa.String(length=500), nullable=True),
        sa.Column('password', sa.String(255)),
        sa.Column('superuser', sa.Boolean(), default=False),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('username')
    )

    op.create_table(
        'chart',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('label', sa.String(length=200), nullable=True),
        sa.Column('conn_id', sa.String(length=250), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('chart_type', sa.String(length=100), nullable=True),
        sa.Column('sql_layout', sa.String(length=50), nullable=True),
        sa.Column('sql', sa.Text(), nullable=True),
        sa.Column('y_log_scale', sa.Boolean(), nullable=True),
        sa.Column('show_datatable', sa.Boolean(), nullable=True),
        sa.Column('show_sql', sa.Boolean(), nullable=True),
        sa.Column('height', sa.Integer(), nullable=True),
        sa.Column('default_params', sa.String(length=5000), nullable=True),
        sa.Column('x_is_date', sa.Boolean(), nullable=True),
        sa.Column('iteration_no', sa.Integer(), nullable=True),
        sa.Column('last_modified', sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
        sa.PrimaryKeyConstraint('id')
    )

    if conn.dialect.name == 'mysql':
        conn.execute("SET time_zone = '+00:00'")
        op.alter_column(table_name='chart', column_name='last_modified', type_=mysql.TIMESTAMP(fsp=6))
    else:
        if conn.dialect.name in ('sqlite', 'mssql'):
            return

        if conn.dialect.name == 'postgresql':
            conn.execute("set timezone=UTC")

        op.alter_column(table_name='chart', column_name='last_modified', type_=sa.TIMESTAMP(timezone=True))
def upgrade():
    op.create_table(
        'medium_programming',
        sa.Column('id',
                  sa.Integer(),
                  autoincrement=True,
                  nullable=False,
                  primary_key=True),
        sa.Column('hash_id', sa.Integer(), autoincrement=False,
                  nullable=False),
        sa.Column('title', sa.String(200), autoincrement=False,
                  nullable=False),
        sa.Column('url', sa.String(2000), autoincrement=False, nullable=False),
        sa.Column('create_time',
                  mysql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True,
                  server_default=sa.text('CURRENT_TIMESTAMP')))
コード例 #4
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('case',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('name', mysql.VARCHAR(length=80), nullable=True),
                    sa.Column('url', mysql.VARCHAR(length=80), nullable=True),
                    sa.Column('is_exe', mysql.ENUM('yes', 'no'),
                              nullable=True),
                    sa.Column('method',
                              mysql.ENUM('get', 'post'),
                              nullable=True),
                    sa.Column('headers',
                              mysql.VARCHAR(length=200),
                              nullable=True),
                    sa.Column('params',
                              mysql.VARCHAR(length=200),
                              nullable=True),
                    sa.Column('data', mysql.VARCHAR(length=500),
                              nullable=True),
                    sa.Column('expect_code',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('expect_return',
                              mysql.VARCHAR(length=500),
                              nullable=True),
                    sa.Column('level', mysql.ENUM('1', '2'), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset='utf8',
                    mysql_engine='InnoDB')
    op.create_index('name', 'case', ['name'], unique=True)
    op.create_table('report',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('content', mysql.MEDIUMTEXT(), nullable=True),
                    sa.Column('create_time', mysql.TIMESTAMP(), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset='utf8',
                    mysql_engine='InnoDB')
コード例 #5
0
ファイル: 9dd167f162ab_.py プロジェクト: zGuil/Pizzou2
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('sale',
                    'date',
                    existing_type=mysql.TIMESTAMP(),
                    nullable=True)
    op.alter_column('item_venda',
                    'id_venda',
                    existing_type=mysql.INTEGER(),
                    nullable=True)
    op.create_table('teste',
                    sa.Column('id',
                              mysql.INTEGER(),
                              autoincrement=True,
                              nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_collate='utf8mb4_0900_ai_ci',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
コード例 #6
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'user',
        sa.Column('last_login_at',
                  mysql.TIMESTAMP(),
                  server_default=sa.text('CURRENT_TIMESTAMP'),
                  nullable=True))
    op.drop_index(op.f('ix_user_updated_on'), table_name='user')
    op.drop_index(op.f('ix_user_name'), table_name='user')
    op.drop_index(op.f('ix_user_last_name'), table_name='user')
    op.drop_index(op.f('ix_user_id'), table_name='user')
    op.drop_index(op.f('ix_user_created_at'), table_name='user')
    op.drop_column('user', 'last_name')
    op.drop_index(op.f('ix_phone_number'), table_name='phone')
    op.create_index('ix_phone_number', 'phone', ['number'], unique=False)
    op.drop_index(op.f('ix_phone_ddd'), table_name='phone')
    op.create_index('ix_phone_ddd', 'phone', ['ddd'], unique=False)
    op.drop_index(op.f('ix_phone_user_id'), table_name='phone')
コード例 #7
0
def upgrade():
  """Creates the initial uwsolar tables."""
  # volttron_table_definitions
  op.create_table(
      'volttron_table_definitions',
      sa.Column('table_id', sa.String(512), primary_key=True),
      sa.Column('table_name', sa.String(512), nullable=False),
      sa.Column('table_prefix', sa.String(512), default=None),
      mysql_engine='innodb',
      mysql_charset='latin1')

  # topics
  op.create_table(
      'topics',
      sa.Column('topic_id', sa.Integer, primary_key=True, autoincrement=True),
      sa.Column('topic_name', sa.String(512), nullable=False, unique=True),
      mysql_engine='innodb',
      mysql_charset='latin1')

  # meta
  op.create_table(
      'meta',
      sa.Column('topic_id', sa.Integer, primary_key=True, autoincrement=True),
      sa.Column('metadata', sa.Text, nullable=False),
      mysql_engine='innodb',
      mysql_charset='latin1')

  # data
  op.create_table(
      'data',
      sa.Column(
          'ts',
          samysql.TIMESTAMP(fsp=6),
          nullable=False,
          default=sa.func.current_timestamp(),
          onupdate=sa.func.current_timestamp),
      sa.Column('topic_id', sa.Integer, nullable=False),
      sa.Column('value_string', sa.Text, nullable=False),
      mysql_engine='innodb',
      mysql_charset='latin1')
  op.create_index('ts', 'data', ['ts', 'topic_id'], unique=True)
  op.create_index('data_idx', 'data', ['ts'])
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'sv_users',
        sa.Column('id',
                  mysql.INTEGER(display_width=11),
                  autoincrement=True,
                  nullable=False,
                  comment='Уникальный идентификатор пользователя'),
        sa.Column('email',
                  mysql.VARCHAR(length=32),
                  nullable=False,
                  comment='Эл почта пользователя и логин'),
        sa.Column('password',
                  mysql.VARCHAR(length=64),
                  nullable=False,
                  comment='Пароль пользователя'),
        sa.Column('fullname',
                  mysql.VARCHAR(length=64),
                  nullable=True,
                  comment='ФИО пользователя'),
        sa.Column('phone',
                  mysql.VARCHAR(length=16),
                  nullable=True,
                  comment='Номер телефона'),
        sa.Column('user_desc',
                  mysql.VARCHAR(length=512),
                  nullable=True,
                  comment='Краткое описание'),
        sa.Column('disabled',
                  sa.CHAR(length=1),
                  nullable=True,
                  comment='Признак блокировки аккаунта'),
        sa.Column('verified',
                  sa.CHAR(length=1),
                  nullable=True,
                  comment='Признак верификации аккаунта'),
        sa.Column('create_date',
                  mysql.TIMESTAMP(),
                  nullable=False,
                  comment='Дата создания аккаунта'),
        sa.PrimaryKeyConstraint('id'))
コード例 #9
0
def upgrade():
    op.create_table(
        'meituan_meishi',
        sa.Column('id',
                  sa.Integer(),
                  autoincrement=True,
                  nullable=False,
                  primary_key=True),
        sa.Column('poiId', sa.Integer(), nullable=False),
        sa.Column('frontImg', sa.String(200), nullable=False),
        sa.Column('title', sa.String(200), nullable=False),
        sa.Column('avgScore', sa.Float(10, 2), nullable=False),
        sa.Column('allCommentNum', sa.Integer(), nullable=False),
        sa.Column('address', sa.String(200), nullable=False),
        sa.Column('avgPrice', sa.Float(10, 2), nullable=False),
        sa.Column('create_time',
                  mysql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True,
                  server_default=sa.text('CURRENT_TIMESTAMP')))
def upgrade():
    op.create_table(
        'douban_dianying',
        sa.Column('id',
                  sa.Integer(),
                  autoincrement=True,
                  nullable=False,
                  primary_key=True),
        sa.Column('file_id', sa.Integer(), nullable=False),
        sa.Column('title', sa.String(200), nullable=False),
        sa.Column('score', sa.Float(10, 2), nullable=False),
        sa.Column('region', sa.String(200), nullable=False),
        sa.Column('img', sa.String(200), nullable=False),
        sa.Column('url', sa.String(200), nullable=False),
        sa.Column('buy_ticket', sa.String(200), nullable=False),
        sa.Column('create_time',
                  mysql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True,
                  server_default=sa.text('CURRENT_TIMESTAMP')))
コード例 #11
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('login', mysql.VARCHAR(length=32), nullable=False),
    sa.Column('name', mysql.VARCHAR(length=32), nullable=False),
    sa.Column('lastname', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('email', mysql.VARCHAR(length=64), nullable=False),
    sa.Column('pass_hash', mysql.VARCHAR(length=128), nullable=False),
    sa.Column('datetime_reg', mysql.TIMESTAMP(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate='utf8mb4_0900_ai_ci',
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_users_login', 'users', ['login'], unique=True)
    op.create_index('ix_users_email', 'users', ['email'], unique=True)
    op.drop_table('post')
    op.drop_index(op.f('ix_user_login'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
コード例 #12
0
def upgrade():
    op.create_table(
        'user',
        sa.Column('id',
                  sa.Integer(),
                  autoincrement=True,
                  nullable=False,
                  primary_key=True),
        sa.Column('username',
                  sa.String(200),
                  autoincrement=False,
                  nullable=False),
        sa.Column('password',
                  sa.String(200),
                  autoincrement=False,
                  nullable=False),
        sa.Column('create_time',
                  mysql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True,
                  server_default=sa.text('CURRENT_TIMESTAMP')))
def upgrade():
    op.create_table('book_type',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              nullable=False),
                    sa.Column('book_type',
                              mysql.VARCHAR(length=126),
                              nullable=False),
                    sa.Column('charge', mysql.DECIMAL(20, 6), nullable=False),
                    sa.Column('created_on',
                              mysql.DATETIME(),
                              server_default=sa.text(u'CURRENT_TIMESTAMP'),
                              nullable=True),
                    sa.Column(
                        'modified_on',
                        mysql.TIMESTAMP(),
                        server_default=sa.text(
                            u'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),
                        nullable=False),
                    sa.Column('is_deleted',
                              mysql.TINYINT(display_width=1),
                              server_default=sa.text(u"'0'"),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset=u'latin1',
                    mysql_engine=u'InnoDB')
    op.add_column(
        'books',
        sa.Column('book_type_id',
                  mysql.INTEGER(display_width=11),
                  nullable=False))
    op.drop_column('books', 'charge')
    op.create_foreign_key(
        'fk_book_type_id',
        'books',
        'book_type',
        ['book_type_id'],
        ['id'],
    )
コード例 #14
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cards',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11, unsigned=True),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('word', mysql.VARCHAR(length=250),
                              nullable=True),
                    sa.Column('definition', mysql.TEXT(), nullable=True),
                    sa.Column('wrong_count',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('available', mysql.TIMESTAMP(), nullable=True),
                    sa.Column('bucket',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset='utf8',
                    mysql_engine='InnoDB')
コード例 #15
0
ファイル: 8049dad0f3dd_.py プロジェクト: plWang/wordcount
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('entries',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('title', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('text', mysql.VARCHAR(length=1024), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('djevents',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('title', mysql.VARCHAR(length=4096), server_default=sa.text(u"''"), nullable=False),
    sa.Column('date', mysql.VARCHAR(length=4096), server_default=sa.text(u"''"), nullable=False),
    sa.Column('gist', mysql.VARCHAR(length=4096), server_default=sa.text(u"''"), nullable=False),
    sa.Column('occupancy', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('occupied', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('update_time', mysql.TIMESTAMP(), server_default=sa.text(u'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
コード例 #16
0
def upgrade():
    op.create_table('user_book_mapping',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              nullable=False),
                    sa.Column('user_id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('book_id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('created_on',
                              mysql.DATETIME(),
                              server_default=sa.text(u'CURRENT_TIMESTAMP'),
                              nullable=True),
                    sa.Column(
                        'modified_on',
                        mysql.TIMESTAMP(),
                        server_default=sa.text(
                            u'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),
                        nullable=False),
                    sa.Column('is_deleted',
                              mysql.TINYINT(display_width=1),
                              server_default=sa.text(u"'0'"),
                              autoincrement=False,
                              nullable=True),
                    sa.ForeignKeyConstraint(['book_id'], [u'books.id'],
                                            name=u'user_book_mapping_ibfk_2'),
                    sa.ForeignKeyConstraint(['user_id'], [u'users.id'],
                                            name=u'user_book_mapping_ibfk_1'),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset=u'latin1',
                    mysql_engine=u'InnoDB')
    op.create_index('user_id',
                    'user_book_mapping', ['user_id', 'book_id'],
                    unique=True)
def upgrade():
    """Apply Add scheduling_decision to DagRun and DAG"""
    conn = op.get_bind()  # pylint: disable=no-member
    is_mysql = bool(conn.dialect.name == "mysql")
    is_sqlite = bool(conn.dialect.name == "sqlite")
    timestamp = sa.TIMESTAMP(timezone=True) if not is_mysql else mysql.TIMESTAMP(fsp=6, timezone=True)

    with op.batch_alter_table('dag_run', schema=None) as batch_op:
        batch_op.add_column(sa.Column('last_scheduling_decision', timestamp, nullable=True))
        batch_op.create_index('idx_last_scheduling_decision', ['last_scheduling_decision'], unique=False)
        batch_op.add_column(sa.Column('dag_hash', sa.String(32), nullable=True))

    with op.batch_alter_table('dag', schema=None) as batch_op:
        batch_op.add_column(sa.Column('next_dagrun', timestamp, nullable=True))
        batch_op.add_column(sa.Column('next_dagrun_create_after', timestamp, nullable=True))
        # Create with nullable and no default, then ALTER to set values, to avoid table level lock
        batch_op.add_column(sa.Column('concurrency', sa.Integer(), nullable=True))
        batch_op.add_column(sa.Column('has_task_concurrency_limits', sa.Boolean(), nullable=True))

        batch_op.create_index('idx_next_dagrun_create_after', ['next_dagrun_create_after'], unique=False)

    try:
        from airflow.configuration import conf
        concurrency = conf.getint('core', 'dag_concurrency', fallback=16)
    except:  # noqa
        concurrency = 16

    # Set it to true here as it makes us take the slow/more complete path, and when it's next parsed by the
    # DagParser it will get set to correct value.
    op.execute(
        "UPDATE dag SET concurrency={}, has_task_concurrency_limits={} where concurrency IS NULL".format(
            concurrency, 1 if is_sqlite else sa.true()
        )
    )
    with op.batch_alter_table('dag', schema=None) as batch_op:
        batch_op.alter_column('concurrency', type_=sa.Integer(), nullable=False)
        batch_op.alter_column('has_task_concurrency_limits', type_=sa.Boolean(), nullable=False)
コード例 #18
0
ファイル: 3a9df848d350_.py プロジェクト: AugustLONG/UIAMS
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('competition',
                    'date_created',
                    existing_type=mysql.TIMESTAMP(),
                    nullable=True,
                    existing_server_default=sa.text(u'CURRENT_TIMESTAMP'))
    op.add_column(
        'grade',
        sa.Column('date_created',
                  sa.TIMESTAMP(),
                  server_default=sa.text(u'CURRENT_TIMESTAMP'),
                  nullable=True))
    op.create_index(op.f('ix_grade_date_created'),
                    'grade', ['date_created'],
                    unique=False)
    op.alter_column('major',
                    'date_created',
                    existing_type=mysql.TIMESTAMP(),
                    nullable=True,
                    existing_server_default=sa.text(u'CURRENT_TIMESTAMP'))
    op.alter_column('participant',
                    'date_created',
                    existing_type=mysql.TIMESTAMP(),
                    nullable=True,
                    existing_server_default=sa.text(u'CURRENT_TIMESTAMP'))
    op.alter_column('project',
                    'date_created',
                    existing_type=mysql.TIMESTAMP(),
                    nullable=True,
                    existing_server_default=sa.text(u'CURRENT_TIMESTAMP'))
    op.alter_column('unit',
                    'date_created',
                    existing_type=mysql.TIMESTAMP(),
                    nullable=True,
                    existing_server_default=sa.text(u'CURRENT_TIMESTAMP'))
    op.alter_column('user',
                    'date_created',
                    existing_type=mysql.TIMESTAMP(),
                    nullable=True,
                    existing_server_default=sa.text(u'CURRENT_TIMESTAMP'))
コード例 #19
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('airmaterial_category',
                    'isOrNotHaveEffectiveDate',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('airmaterial_category',
                    'isOrNotHavePeriodCheck',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('airmaterial_category_version',
                    'isOrNotHaveEffectiveDate',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True,
                    autoincrement=False)
    op.alter_column('airmaterial_category_version',
                    'isOrNotHavePeriodCheck',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True,
                    autoincrement=False)
    op.alter_column('basic_action',
                    'airmaterial_record',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'approve',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'approve_refuse',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'approved',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'borrow_application',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'borrowing_in_return',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'cancel',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'check_complete',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_as',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_br',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_eo',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_er',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_in',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_lr',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_mr',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_out',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_rf',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_rp_rt',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_rw',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_scrap',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_st',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'delete',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'edit',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'edit_bound_status',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'export_pdf',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'finish',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'in_store_finish',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'in_store_part',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'out_store_finish',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'out_store_part',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'purchase_application',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'put_in_store',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'receive',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'remove_bound_status',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'reserve_again',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review_again',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review_approve',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review_refuse',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'second_approve_refuse',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'second_approved',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'send',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'sent',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'stored',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'submit',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'submit_review',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'upload_contract_file',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'upload_meeting_file',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'view',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('examine_repair_record',
                    'Soluted',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
    op.alter_column('examine_repair_record_version',
                    'Soluted',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True,
                    autoincrement=False)
    op.alter_column('file_resource',
                    'addTime',
                    existing_type=mysql.TIMESTAMP(),
                    server_default=None,
                    type_=sa.TIMESTAMP(timezone=True),
                    existing_nullable=False)
    op.alter_column('file_resource_version',
                    'addTime',
                    existing_type=mysql.TIMESTAMP(),
                    type_=sa.TIMESTAMP(timezone=True),
                    existing_nullable=True,
                    autoincrement=False)
    op.add_column(
        'flight_log',
        sa.Column('EngineTimeExtra', sa.String(length=255), nullable=True))
    op.add_column(
        'flight_log_version',
        sa.Column('EngineTimeExtra',
                  sa.String(length=255),
                  autoincrement=False,
                  nullable=True))
    op.alter_column('repair_material',
                    'totalUseTime',
                    existing_type=mysql.FLOAT(),
                    type_=sa.String(length=255),
                    existing_nullable=True)
    op.alter_column('user',
                    'active',
                    existing_type=mysql.TINYINT(display_width=1),
                    type_=sa.Boolean(),
                    existing_nullable=True)
コード例 #20
0
def upgrade():
    conn = op.get_bind()
    if conn.dialect.name == "mysql":
        conn.execute("SET time_zone = '+00:00'")
        cur = conn.execute("SELECT @@explicit_defaults_for_timestamp")
        res = cur.fetchall()
        if res[0][0] == 0:
            raise Exception(
                "Global variable explicit_defaults_for_timestamp needs to be on (1) for mysql"
            )

        op.alter_column(
            table_name="chart",
            column_name="last_modified",
            type_=mysql.TIMESTAMP(fsp=6),
        )

        op.alter_column(
            table_name="dag",
            column_name="last_scheduler_run",
            type_=mysql.TIMESTAMP(fsp=6),
        )
        op.alter_column(
            table_name="dag", column_name="last_pickled", type_=mysql.TIMESTAMP(fsp=6)
        )
        op.alter_column(
            table_name="dag", column_name="last_expired", type_=mysql.TIMESTAMP(fsp=6)
        )

        op.alter_column(
            table_name="dag_pickle",
            column_name="created_dttm",
            type_=mysql.TIMESTAMP(fsp=6),
        )

        op.alter_column(
            table_name="dag_run",
            column_name="execution_date",
            type_=mysql.TIMESTAMP(fsp=6),
        )
        op.alter_column(
            table_name="dag_run", column_name="start_date", type_=mysql.TIMESTAMP(fsp=6)
        )
        op.alter_column(
            table_name="dag_run", column_name="end_date", type_=mysql.TIMESTAMP(fsp=6)
        )

        op.alter_column(
            table_name="import_error",
            column_name="timestamp",
            type_=mysql.TIMESTAMP(fsp=6),
        )

        op.alter_column(
            table_name="job", column_name="start_date", type_=mysql.TIMESTAMP(fsp=6)
        )
        op.alter_column(
            table_name="job", column_name="end_date", type_=mysql.TIMESTAMP(fsp=6)
        )
        op.alter_column(
            table_name="job",
            column_name="latest_heartbeat",
            type_=mysql.TIMESTAMP(fsp=6),
        )

        op.alter_column(
            table_name="log", column_name="dttm", type_=mysql.TIMESTAMP(fsp=6)
        )
        op.alter_column(
            table_name="log", column_name="execution_date", type_=mysql.TIMESTAMP(fsp=6)
        )

        op.alter_column(
            table_name="sla_miss",
            column_name="execution_date",
            type_=mysql.TIMESTAMP(fsp=6),
            nullable=False,
        )
        op.alter_column(
            table_name="sla_miss", column_name="timestamp", type_=mysql.TIMESTAMP(fsp=6)
        )

        op.alter_column(
            table_name="task_fail",
            column_name="execution_date",
            type_=mysql.TIMESTAMP(fsp=6),
        )
        op.alter_column(
            table_name="task_fail",
            column_name="start_date",
            type_=mysql.TIMESTAMP(fsp=6),
        )
        op.alter_column(
            table_name="task_fail", column_name="end_date", type_=mysql.TIMESTAMP(fsp=6)
        )

        op.alter_column(
            table_name="task_instance",
            column_name="execution_date",
            type_=mysql.TIMESTAMP(fsp=6),
            nullable=False,
        )
        op.alter_column(
            table_name="task_instance",
            column_name="start_date",
            type_=mysql.TIMESTAMP(fsp=6),
        )
        op.alter_column(
            table_name="task_instance",
            column_name="end_date",
            type_=mysql.TIMESTAMP(fsp=6),
        )
        op.alter_column(
            table_name="task_instance",
            column_name="queued_dttm",
            type_=mysql.TIMESTAMP(fsp=6),
        )

        op.alter_column(
            table_name="xcom", column_name="timestamp", type_=mysql.TIMESTAMP(fsp=6)
        )
        op.alter_column(
            table_name="xcom",
            column_name="execution_date",
            type_=mysql.TIMESTAMP(fsp=6),
        )
    else:
        # sqlite and mssql datetime are fine as is.  Therefore, not converting
        if conn.dialect.name in ("sqlite", "mssql"):
            return

        # we try to be database agnostic, but not every db (e.g. sqlserver)
        # supports per session time zones
        if conn.dialect.name == "postgresql":
            conn.execute("set timezone=UTC")

        op.alter_column(
            table_name="chart",
            column_name="last_modified",
            type_=sa.TIMESTAMP(timezone=True),
        )

        op.alter_column(
            table_name="dag",
            column_name="last_scheduler_run",
            type_=sa.TIMESTAMP(timezone=True),
        )
        op.alter_column(
            table_name="dag",
            column_name="last_pickled",
            type_=sa.TIMESTAMP(timezone=True),
        )
        op.alter_column(
            table_name="dag",
            column_name="last_expired",
            type_=sa.TIMESTAMP(timezone=True),
        )

        op.alter_column(
            table_name="dag_pickle",
            column_name="created_dttm",
            type_=sa.TIMESTAMP(timezone=True),
        )

        op.alter_column(
            table_name="dag_run",
            column_name="execution_date",
            type_=sa.TIMESTAMP(timezone=True),
        )
        op.alter_column(
            table_name="dag_run",
            column_name="start_date",
            type_=sa.TIMESTAMP(timezone=True),
        )
        op.alter_column(
            table_name="dag_run",
            column_name="end_date",
            type_=sa.TIMESTAMP(timezone=True),
        )

        op.alter_column(
            table_name="import_error",
            column_name="timestamp",
            type_=sa.TIMESTAMP(timezone=True),
        )

        op.alter_column(
            table_name="job",
            column_name="start_date",
            type_=sa.TIMESTAMP(timezone=True),
        )
        op.alter_column(
            table_name="job", column_name="end_date", type_=sa.TIMESTAMP(timezone=True)
        )
        op.alter_column(
            table_name="job",
            column_name="latest_heartbeat",
            type_=sa.TIMESTAMP(timezone=True),
        )

        op.alter_column(
            table_name="log", column_name="dttm", type_=sa.TIMESTAMP(timezone=True)
        )
        op.alter_column(
            table_name="log",
            column_name="execution_date",
            type_=sa.TIMESTAMP(timezone=True),
        )

        op.alter_column(
            table_name="sla_miss",
            column_name="execution_date",
            type_=sa.TIMESTAMP(timezone=True),
            nullable=False,
        )
        op.alter_column(
            table_name="sla_miss",
            column_name="timestamp",
            type_=sa.TIMESTAMP(timezone=True),
        )

        op.alter_column(
            table_name="task_fail",
            column_name="execution_date",
            type_=sa.TIMESTAMP(timezone=True),
        )
        op.alter_column(
            table_name="task_fail",
            column_name="start_date",
            type_=sa.TIMESTAMP(timezone=True),
        )
        op.alter_column(
            table_name="task_fail",
            column_name="end_date",
            type_=sa.TIMESTAMP(timezone=True),
        )

        op.alter_column(
            table_name="task_instance",
            column_name="execution_date",
            type_=sa.TIMESTAMP(timezone=True),
            nullable=False,
        )
        op.alter_column(
            table_name="task_instance",
            column_name="start_date",
            type_=sa.TIMESTAMP(timezone=True),
        )
        op.alter_column(
            table_name="task_instance",
            column_name="end_date",
            type_=sa.TIMESTAMP(timezone=True),
        )
        op.alter_column(
            table_name="task_instance",
            column_name="queued_dttm",
            type_=sa.TIMESTAMP(timezone=True),
        )

        op.alter_column(
            table_name="xcom",
            column_name="timestamp",
            type_=sa.TIMESTAMP(timezone=True),
        )
        op.alter_column(
            table_name="xcom",
            column_name="execution_date",
            type_=sa.TIMESTAMP(timezone=True),
        )
コード例 #21
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('user')
    op.drop_table('rel_user')
    op.drop_table('rel_user_text')
    op.drop_table('rel_user_multi')
    ### end Alembic commands ###
    
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('rel_user_multi',
    sa.Column('rum_id', mysql.INTEGER(display_width=10, unsigned=True), nullable=False),
    sa.Column('user_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('rel_lookup', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('attribute', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('create_transaction_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('create_time', mysql.TIMESTAMP(), server_default=sa.text(u'CURRENT_TIMESTAMP'), nullable=False),
    sa.PrimaryKeyConstraint('rum_id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('rel_user_text',
    sa.Column('rut_id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('user_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('rel_lookup', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('attribute', mysql.TEXT(), nullable=True),
    sa.Column('create_transaction_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('create_time', mysql.TIMESTAMP(), server_default=sa.text(u'CURRENT_TIMESTAMP'), nullable=False),
    sa.PrimaryKeyConstraint('rut_id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('rel_user',
    sa.Column('user_id', mysql.INTEGER(display_width=10, unsigned=True), server_default=sa.text(u"'0'"), autoincrement=False, nullable=False),
    sa.Column('rel_lookup', mysql.VARCHAR(length=128), server_default=sa.text(u"''"), nullable=False),
    sa.Column('attribute', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('create_transaction_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('create_time', mysql.TIMESTAMP(), server_default=sa.text(u'CURRENT_TIMESTAMP'), nullable=False),
    sa.PrimaryKeyConstraint('user_id', 'rel_lookup'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('user',
    sa.Column('user_id', mysql.INTEGER(display_width=10, unsigned=True), nullable=False),
    sa.Column('username', mysql.VARCHAR(length=128), nullable=True),
    sa.Column('email_address', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('display_name', mysql.VARCHAR(length=50), nullable=True),
    sa.Column('signup_date', sa.DATE(), nullable=True),
    sa.Column('enroll_status', mysql.VARCHAR(length=50), server_default=sa.text(u"'PreValid'"), nullable=False),
    sa.Column('enroll_complete', mysql.TINYINT(display_width=1), server_default=sa.text(u"'0'"), autoincrement=False, nullable=True),
    sa.Column('tier', mysql.VARCHAR(length=50), server_default=sa.text(u"'Carbon'"), nullable=False),
    sa.Column('last_interaction_dttm', mysql.TIMESTAMP(), nullable=True),
    sa.Column('group_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('current_ohm_service_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('point_balance', mysql.DOUBLE(asdecimal=True), server_default=sa.text(u"'0'"), nullable=False),
    sa.Column('credit_balance', mysql.DOUBLE(asdecimal=True), server_default=sa.text(u"'0'"), nullable=False),
    sa.Column('donated_points', mysql.DOUBLE(asdecimal=True), server_default=sa.text(u"'0'"), nullable=False),
    sa.Column('lifetime_points', mysql.DOUBLE(asdecimal=True), server_default=sa.text(u"'0'"), nullable=False),
    sa.Column('create_transaction_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('create_time', mysql.TIMESTAMP(), server_default=sa.text(u'CURRENT_TIMESTAMP'), nullable=True),
    sa.PrimaryKeyConstraint('user_id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
コード例 #22
0
def mysql_timestamp():
    return mysql.TIMESTAMP(fsp=6)
コード例 #23
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'users', sa.Column('updatetimestamp',
                           mysql.TIMESTAMP(),
                           nullable=False))
コード例 #24
0
 def load_dialect_impl(self, dialect):
     if dialect.name == 'mssql':
         return mssql.DATETIME2(precision=6)
     elif dialect.name == 'mysql':
         return mysql.TIMESTAMP(fsp=6)
     return super().load_dialect_impl(dialect)
コード例 #25
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'youtube', type_='foreignkey')
    op.drop_constraint(None, 'twitter', type_='foreignkey')
    op.drop_constraint(None, 'spoc_details', type_='foreignkey')
    op.drop_constraint(None, 'rel_influencer_notification', type_='foreignkey')
    op.drop_constraint(None, 'rel_influencer_notification', type_='foreignkey')
    op.drop_constraint(None, 'rel_influencer_interest', type_='foreignkey')
    op.drop_constraint(None, 'rel_influencer_interest', type_='foreignkey')
    op.drop_constraint(None, 'rel_campaign_interest', type_='foreignkey')
    op.drop_constraint(None, 'rel_campaign_interest', type_='foreignkey')
    op.drop_constraint(None, 'rel_campaign_influencer_inv', type_='foreignkey')
    op.drop_constraint(None, 'rel_campaign_influencer_inv', type_='foreignkey')
    op.drop_constraint(None, 'rel_brand_notification', type_='foreignkey')
    op.drop_constraint(None, 'rel_brand_notification', type_='foreignkey')
    op.drop_constraint(None, 'rel_brand_interest', type_='foreignkey')
    op.drop_constraint(None, 'rel_brand_interest', type_='foreignkey')
    op.drop_constraint(None, 'pricing_details', type_='foreignkey')
    op.drop_constraint(None, 'posts_done', type_='foreignkey')
    op.drop_constraint(None, 'payments', type_='foreignkey')
    op.drop_constraint(None, 'payments', type_='foreignkey')
    op.drop_constraint(None, 'otp_details', type_='foreignkey')
    op.drop_constraint(None, 'otp_details', type_='foreignkey')
    op.drop_constraint(None, 'location', type_='foreignkey')
    op.drop_constraint(None, 'location', type_='foreignkey')
    op.drop_constraint(None, 'location', type_='foreignkey')
    op.drop_constraint(None, 'interest_details', type_='foreignkey')
    op.drop_constraint(None, 'interest_details', type_='foreignkey')
    op.drop_constraint(None, 'interest_details', type_='foreignkey')
    op.drop_constraint(None, 'instagram', type_='foreignkey')
    op.drop_constraint(None, 'influencers_involved', type_='foreignkey')
    op.drop_constraint(None, 'influencers_involved', type_='foreignkey')
    op.drop_constraint(None, 'facebook', type_='foreignkey')
    op.drop_constraint(None, 'created_table', type_='foreignkey')
    op.drop_constraint(None, 'campaign_type', type_='foreignkey')
    op.drop_constraint(None, 'campaign_posts', type_='foreignkey')
    op.drop_constraint(None, 'campaign', type_='foreignkey')
    op.drop_constraint(None, 'campaign', type_='foreignkey')
    op.drop_column('campaign', 'linktoshare')
    op.create_table('se_admin_login',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('username',
                              mysql.VARCHAR(length=500),
                              nullable=True),
                    sa.Column('password',
                              mysql.VARCHAR(length=500),
                              nullable=True),
                    sa.Column('name', mysql.VARCHAR(length=500),
                              nullable=True),
                    sa.Column('email',
                              mysql.VARCHAR(length=500),
                              nullable=True),
                    sa.Column('mobile',
                              mysql.VARCHAR(length=10),
                              nullable=True),
                    sa.Column('image',
                              mysql.VARCHAR(length=1000),
                              server_default=sa.text("'no-image.jpg'"),
                              nullable=False),
                    sa.Column('ddate',
                              mysql.TIMESTAMP(),
                              server_default=sa.text('CURRENT_TIMESTAMP'),
                              nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset='latin1',
                    mysql_engine='InnoDB')
コード例 #26
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        's3_fc20',
        sa.Column('latest_record_id',
                  mysql.INTEGER(display_width=11),
                  autoincrement=False,
                  nullable=True))
    op.create_foreign_key('s3_fc20_ibfk_3',
                          's3_fc20',
                          's3_fc20_records', ['latest_record_id'], ['id'],
                          ondelete='SET NULL')
    op.alter_column('notification',
                    'title',
                    existing_type=sa.Unicode(length=50),
                    type_=mysql.VARCHAR(charset='utf8', length=400),
                    existing_nullable=True)
    op.add_column(
        'mantunci_box',
        sa.Column('latest_alarm_id',
                  mysql.INTEGER(display_width=11),
                  autoincrement=False,
                  nullable=True))
    op.create_foreign_key('mantunci_box_ibfk_3',
                          'mantunci_box',
                          'box_alarms', ['latest_alarm_id'], ['id'],
                          ondelete='SET NULL')
    op.create_table('s3_fc20_records',
                    sa.Column('created_at',
                              mysql.TIMESTAMP(),
                              server_default=sa.text('CURRENT_TIMESTAMP'),
                              nullable=False),
                    sa.Column('updated_at', mysql.TIMESTAMP(), nullable=True),
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('s3_fc20_id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('title', mysql.VARCHAR(length=50),
                              nullable=True),
                    sa.Column('validity',
                              mysql.TINYINT(display_width=1),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('enable_netctr',
                              mysql.TINYINT(display_width=1),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('oc',
                              mysql.TINYINT(display_width=1),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('online',
                              mysql.TINYINT(display_width=1),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('total_power', mysql.FLOAT(), nullable=True),
                    sa.Column('mxgg', mysql.FLOAT(), nullable=True),
                    sa.Column('mxgl', mysql.FLOAT(), nullable=True),
                    sa.Column('line_type',
                              mysql.SMALLINT(display_width=6),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('spec', mysql.VARCHAR(length=50), nullable=True),
                    sa.Column('control',
                              mysql.TINYINT(display_width=1),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('visibility',
                              mysql.TINYINT(display_width=1),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('alarm',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('gLd', mysql.FLOAT(), nullable=True),
                    sa.Column('gA', mysql.FLOAT(), nullable=True),
                    sa.Column('gT', mysql.FLOAT(), nullable=True),
                    sa.Column('gV', mysql.FLOAT(), nullable=True),
                    sa.Column('gW', mysql.FLOAT(), nullable=True),
                    sa.Column('gPF', mysql.FLOAT(), nullable=True),
                    sa.Column('aA', mysql.FLOAT(), nullable=True),
                    sa.Column('aT', mysql.FLOAT(), nullable=True),
                    sa.Column('aV', mysql.FLOAT(), nullable=True),
                    sa.Column('aW', mysql.FLOAT(), nullable=True),
                    sa.Column('aPF', mysql.FLOAT(), nullable=True),
                    sa.Column('bA', mysql.FLOAT(), nullable=True),
                    sa.Column('bT', mysql.FLOAT(), nullable=True),
                    sa.Column('bV', mysql.FLOAT(), nullable=True),
                    sa.Column('bW', mysql.FLOAT(), nullable=True),
                    sa.Column('bPF', mysql.FLOAT(), nullable=True),
                    sa.Column('cA', mysql.FLOAT(), nullable=True),
                    sa.Column('cT', mysql.FLOAT(), nullable=True),
                    sa.Column('cV', mysql.FLOAT(), nullable=True),
                    sa.Column('cW', mysql.FLOAT(), nullable=True),
                    sa.Column('cPF', mysql.FLOAT(), nullable=True),
                    sa.Column('nA', mysql.FLOAT(), nullable=True),
                    sa.Column('nT', mysql.FLOAT(), nullable=True),
                    sa.ForeignKeyConstraint(['s3_fc20_id'], ['s3_fc20.id'],
                                            name='s3_fc20_records_ibfk_1',
                                            ondelete='CASCADE'),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset='utf8',
                    mysql_engine='InnoDB')
コード例 #27
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('user',
                    'active',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.drop_column('scrap_material', 'nextCheckDate')
    op.drop_column('scrap_material', 'lastCheckDate')
    op.drop_column('scrap_material', 'effectiveDate')
    op.drop_column('repair_material', 'nextCheckDate')
    op.drop_column('repair_material', 'lastCheckDate')
    op.drop_column('repair_material', 'effectiveDate')
    op.drop_column('put_out_store_material', 'effectiveDate')
    op.drop_column('loan_material', 'effectiveDate')
    op.alter_column('file_resource_version',
                    'addTime',
                    existing_type=sa.TIMESTAMP(timezone=True),
                    type_=mysql.TIMESTAMP(),
                    existing_nullable=True,
                    autoincrement=False)
    op.alter_column('file_resource',
                    'addTime',
                    existing_type=sa.TIMESTAMP(timezone=True),
                    server_default=sa.text(
                        u'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),
                    type_=mysql.TIMESTAMP(),
                    existing_nullable=False)
    op.alter_column('examine_repair_record_version',
                    'Soluted',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True,
                    autoincrement=False)
    op.alter_column('examine_repair_record',
                    'Soluted',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.drop_column('disassemble_material', 'effectiveDate')
    op.drop_column('borrowing_in_return_material', 'nextCheckDate')
    op.drop_column('borrowing_in_return_material', 'effectiveDate')
    op.alter_column('basic_action',
                    'view',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'upload_meeting_file',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'upload_contract_file',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'submit_review',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'submit',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'stored',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'sent',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'send',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'second_approved',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'second_approve_refuse',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review_refuse',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review_approve',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review_again',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'reserve_again',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'receive',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'put_in_store',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'purchase_application',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'out_store_part',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'out_store_finish',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'in_store_part',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'in_store_finish',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'finish',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'edit_bound_status',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'edit',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'delete',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_st',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_scrap',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_rw',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_rp_rt',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_rf',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_out',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_mr',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_lr',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_in',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_er',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_eo',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_br',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_as',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'check_complete',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'cancel',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'borrowing_in_return',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'borrow_application',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'approved',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'approve_refuse',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'approve',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.drop_column('assemble_application_list', 'effectiveDate')
    op.alter_column('airmaterial_category_version',
                    'isOrNotHavePeriodCheck',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True,
                    autoincrement=False)
    op.alter_column('airmaterial_category_version',
                    'isOrNotHaveEffectiveDate',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True,
                    autoincrement=False)
    op.alter_column('airmaterial_category',
                    'isOrNotHavePeriodCheck',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('airmaterial_category',
                    'isOrNotHaveEffectiveDate',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
def mysql_timestamp():  # noqa: D103
    return mysql.TIMESTAMP(fsp=6)
コード例 #29
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('user',
                    'active',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.add_column('trouble_shooting_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('trouble_shooting_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('trouble_shooting',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('trouble_shooting',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_record_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column(
        'train_record_version',
        sa.Column('createUser', mysql.VARCHAR(length=255), nullable=True))
    op.add_column(
        'train_record_version',
        sa.Column('submitUser', mysql.VARCHAR(length=255), nullable=True))
    op.add_column('train_record_version',
                  sa.Column('submitTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_record_version',
                  sa.Column('addTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_record_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_record_version',
                  sa.Column('updTime', mysql.DATETIME(), nullable=True))
    op.add_column(
        'train_record_version',
        sa.Column('updateUser', mysql.VARCHAR(length=255), nullable=True))
    op.add_column('train_record',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column(
        'train_record',
        sa.Column('createUser', mysql.VARCHAR(length=255), nullable=True))
    op.add_column(
        'train_record',
        sa.Column('submitUser', mysql.VARCHAR(length=255), nullable=True))
    op.add_column('train_record',
                  sa.Column('submitTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_record',
                  sa.Column('addTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_record',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_record',
                  sa.Column('updTime', mysql.DATETIME(), nullable=True))
    op.add_column(
        'train_record',
        sa.Column('updateUser', mysql.VARCHAR(length=255), nullable=True))
    op.add_column('train_plan_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_plan_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_plan',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_plan',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_file_resource_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_file_resource_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_file_resource',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('train_file_resource',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('shengchanzl_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('shengchanzl_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('shengchanzl',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('shengchanzl',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('plan_fault_statistical',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('plan_fault_statistical',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('maintenance_status',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('maintenance_status',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('maintenance_plan',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('maintenance_plan',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('flight_log_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('flight_log_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('flight_log',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('flight_log',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('file_resource_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('file_resource_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.alter_column('file_resource_version',
                    'addTime',
                    existing_type=sa.TIMESTAMP(timezone=True),
                    type_=mysql.TIMESTAMP(),
                    existing_nullable=True,
                    autoincrement=False)
    op.add_column('file_resource',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('file_resource',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.alter_column('file_resource',
                    'addTime',
                    existing_type=sa.TIMESTAMP(timezone=True),
                    server_default=sa.text(
                        u'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),
                    type_=mysql.TIMESTAMP(),
                    existing_nullable=False)
    op.add_column('fault_reports_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('fault_reports_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('fault_reports',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('fault_reports',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('examine_repair_record_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('examine_repair_record_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.alter_column('examine_repair_record_version',
                    'Soluted',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True,
                    autoincrement=False)
    op.add_column('examine_repair_record',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('examine_repair_record',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.alter_column('examine_repair_record',
                    'Soluted',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.add_column('continues_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('continues_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('continues',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('continues',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.alter_column('basic_action',
                    'view',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'upload_meeting_file',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'upload_contract_file',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'submit_review',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'submit',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'stored',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'sent',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'send',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'second_approved',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'second_approve_refuse',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review_refuse',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review_approve',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review_again',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'review',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'reserve_again',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'remove_bound_status',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'receive',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'put_in_store',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'purchase_application',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'out_store_part',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'out_store_finish',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'in_store_part',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'in_store_finish',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'finish',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'export_pdf',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'edit_bound_status',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'edit',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'delete',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_st',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_scrap',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_rw',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_rp_rt',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_rf',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_out',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_mr',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_lr',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_in',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_er',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_eo',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_br',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create_as',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'create',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'check_complete',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'cancel',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'borrowing_in_return',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'borrow_application',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'approved',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'approve_refuse',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('basic_action',
                    'approve',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('airmaterial_category_version',
                    'isOrNotHavePeriodCheck',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True,
                    autoincrement=False)
    op.alter_column('airmaterial_category_version',
                    'isOrNotHaveEffectiveDate',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True,
                    autoincrement=False)
    op.alter_column('airmaterial_category',
                    'isOrNotHavePeriodCheck',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.alter_column('airmaterial_category',
                    'isOrNotHaveEffectiveDate',
                    existing_type=sa.Boolean(),
                    type_=mysql.TINYINT(display_width=1),
                    existing_nullable=True)
    op.add_column('air_lxgz_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_lxgz_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_lxgz',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_lxgz',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_flxgz',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_flxgz',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_blgz_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_blgz_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_blgz',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_blgz',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_blguzhang_version',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_blguzhang_version',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_blguzhang',
                  sa.Column('createTime', mysql.DATETIME(), nullable=True))
    op.add_column('air_blguzhang',
                  sa.Column('updateTime', mysql.DATETIME(), nullable=True))
コード例 #30
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tbl_task_email_group',
                    sa.Column('id',
                              mysql.BIGINT(display_width=20),
                              autoincrement=True,
                              nullable=False,
                              comment='自增主键id'),
                    sa.Column('name',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='邮件组名称'),
                    sa.Column('title',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='邮件标题'),
                    sa.Column('receive',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='收件人,多个用英文逗号分隔'),
                    sa.Column('cc',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='抄送人,多个用英文逗号分隔'),
                    sa.Column('status',
                              mysql.TINYINT(display_width=2),
                              server_default=sa.text("'1'"),
                              autoincrement=False,
                              nullable=False,
                              comment='状态,0不启动,1启动'),
                    sa.Column('createTime',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=20),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='创建时间'),
                    sa.Column('actionTime',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=20),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='更新时间'),
                    sa.Column('createManager',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='创建人'),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_collate='utf8mb4_unicode_ci',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_table('tbl_task_table_count',
                    sa.Column('id',
                              mysql.BIGINT(display_width=20),
                              autoincrement=True,
                              nullable=False,
                              comment='自增主键id'),
                    sa.Column('dbUrl',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='数据库链接'),
                    sa.Column('dbTableName',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='数据表名称'),
                    sa.Column('count',
                              mysql.BIGINT(display_width=20),
                              server_default=sa.text("'0'"),
                              autoincrement=False,
                              nullable=False,
                              comment='每天数据量'),
                    sa.Column('createTime',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=20),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='创建时间'),
                    sa.Column('actionTime',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=20),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='更新时间'),
                    sa.Column('emailGroupId',
                              mysql.BIGINT(display_width=20),
                              server_default=sa.text("'0'"),
                              autoincrement=False,
                              nullable=False,
                              comment='邮件组id'),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_collate='utf8mb4_unicode_ci',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_table('tbl_test_mitrics',
                    sa.Column('id',
                              mysql.BIGINT(display_width=20),
                              autoincrement=True,
                              nullable=False,
                              comment='value'),
                    sa.Column('metrics',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=20),
                              nullable=True,
                              comment='metrics'),
                    sa.Column(
                        'time_sec',
                        mysql.TIMESTAMP(),
                        server_default=sa.text(
                            'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),
                        nullable=False,
                        comment='time_sec'),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_collate='utf8mb4_unicode_ci',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_table('tbl_account_month_static',
                    sa.Column('id',
                              mysql.BIGINT(display_width=20),
                              autoincrement=True,
                              nullable=False,
                              comment='主键'),
                    sa.Column('monthStr',
                              mysql.VARCHAR(length=10),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='统计时间 Mar-19'),
                    sa.Column('bizType',
                              mysql.VARCHAR(length=5),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='业务类型'),
                    sa.Column('consumeAmt',
                              mysql.DECIMAL(precision=16, scale=2),
                              server_default=sa.text("'0.00'"),
                              nullable=False,
                              comment='消费金额'),
                    sa.Column('consumeCount',
                              mysql.BIGINT(display_width=12),
                              server_default=sa.text("'0'"),
                              autoincrement=False,
                              nullable=False,
                              comment='消费笔数'),
                    sa.Column('correctAmt',
                              mysql.DECIMAL(precision=16, scale=2),
                              server_default=sa.text("'0.00'"),
                              nullable=False,
                              comment='退回金额'),
                    sa.Column('correctCount',
                              mysql.BIGINT(display_width=12),
                              server_default=sa.text("'0'"),
                              autoincrement=False,
                              nullable=False,
                              comment='退回笔数'),
                    sa.Column('rechargeAmt',
                              mysql.DECIMAL(precision=16, scale=2),
                              server_default=sa.text("'0.00'"),
                              nullable=False,
                              comment='充值金额'),
                    sa.Column('rechargeCount',
                              mysql.BIGINT(display_width=12),
                              server_default=sa.text("'0'"),
                              autoincrement=False,
                              nullable=False,
                              comment='充值笔数'),
                    sa.Column('withdrawAmt',
                              mysql.DECIMAL(precision=16, scale=2),
                              server_default=sa.text("'0.00'"),
                              nullable=False,
                              comment='提现金额'),
                    sa.Column('withdrawCount',
                              mysql.BIGINT(display_width=12),
                              server_default=sa.text("'0'"),
                              autoincrement=False,
                              nullable=False,
                              comment='提现笔数'),
                    sa.Column('receiveAmt',
                              mysql.DECIMAL(precision=16, scale=2),
                              server_default=sa.text("'0.00'"),
                              nullable=False,
                              comment='领取金额'),
                    sa.Column('receiveCount',
                              mysql.BIGINT(display_width=12),
                              server_default=sa.text("'0'"),
                              autoincrement=False,
                              nullable=False,
                              comment='领取笔数'),
                    sa.Column('note',
                              mysql.VARCHAR(length=100),
                              server_default=sa.text("''"),
                              nullable=False,
                              comment='备注'),
                    sa.Column('action',
                              mysql.TINYINT(display_width=2),
                              server_default=sa.text("'0'"),
                              autoincrement=False,
                              nullable=False,
                              comment='操作行为'),
                    sa.Column('createStamp',
                              mysql.TIMESTAMP(),
                              server_default=sa.text("'0000-00-00 00:00:00'"),
                              nullable=False,
                              comment='创建时间'),
                    sa.Column(
                        'actionStamp',
                        mysql.TIMESTAMP(),
                        server_default=sa.text(
                            'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),
                        nullable=False,
                        comment='更新时间'),
                    sa.Column('type',
                              mysql.TINYINT(display_width=2),
                              server_default=sa.text("'0'"),
                              autoincrement=False,
                              nullable=False,
                              comment='统计类型 0日统计 1月统计'),
                    sa.Column('rechargeMoney',
                              mysql.DECIMAL(precision=16, scale=2),
                              server_default=sa.text("'0.00'"),
                              nullable=False,
                              comment='充值金额(元)'),
                    sa.PrimaryKeyConstraint('id'),
                    comment='权益账户月统计表',
                    mysql_comment='权益账户月统计表',
                    mysql_default_charset='utf8',
                    mysql_engine='InnoDB',
                    mysql_row_format='COMPACT')
    op.create_index('uniq_month_bizType',
                    'tbl_account_month_static', ['monthStr', 'bizType'],
                    unique=True)
    op.create_table('bomcdata',
                    sa.Column('id',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=100),
                              server_default=sa.text("''"),
                              nullable=False),
                    sa.Column('name',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=100),
                              nullable=True),
                    sa.Column('id_key',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=100),
                              nullable=True),
                    sa.Column(
                        'date_time_date',
                        mysql.TIMESTAMP(),
                        server_default=sa.text(
                            'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),
                        nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_collate='utf8mb4_unicode_ci',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_table(
        'tbl_task_job',
        sa.Column('id',
                  mysql.BIGINT(display_width=20),
                  autoincrement=True,
                  nullable=False,
                  comment='自增主键id'),
        sa.Column('dbUrl',
                  mysql.VARCHAR(length=255),
                  nullable=False,
                  comment='数据库链接,最后附带库前缀'),
        sa.Column(
            'dbSuffix',
            mysql.VARCHAR(length=255),
            nullable=False,
            comment=
            '库后缀(只支持整数递增,咱不支持后缀带字母),示例:0000-0063(左闭右闭),反例:000a-000z,如果为""代表只扫描单库'
        ),
        sa.Column('dbTableName',
                  mysql.VARCHAR(length=255),
                  nullable=False,
                  comment='数据表名称前缀(如果为""代表扫描该库下所有数据表)'),
        sa.Column(
            'dbTableSuffix',
            mysql.VARCHAR(length=255),
            nullable=False,
            comment=
            '表后缀(只支持整数递增,咱不支持后缀带字母),示例:0000-0063(左闭右闭),反例:000a-000z,如果为""代表扫描该库下所有数据表'
        ),
        sa.Column('dbUsername',
                  mysql.VARCHAR(length=255),
                  nullable=False,
                  comment='数据库username'),
        sa.Column('dbPassword',
                  mysql.VARCHAR(length=255),
                  nullable=False,
                  comment='数据库password'),
        sa.Column('status',
                  mysql.TINYINT(display_width=2),
                  server_default=sa.text("'1'"),
                  autoincrement=False,
                  nullable=False,
                  comment='状态,0停止,1启动'),
        sa.Column('createTime',
                  mysql.VARCHAR(length=50),
                  server_default=sa.text("''"),
                  nullable=False,
                  comment='创建时间'),
        sa.Column('actionTime',
                  mysql.VARCHAR(length=50),
                  server_default=sa.text("''"),
                  nullable=False,
                  comment='更新时间'),
        sa.Column('createManager',
                  mysql.VARCHAR(length=255),
                  nullable=False,
                  comment='创建者'),
        sa.Column('emailGroupId',
                  mysql.BIGINT(display_width=20),
                  autoincrement=False,
                  nullable=False,
                  comment='发送ID'),
        sa.PrimaryKeyConstraint('id'),
        mysql_default_charset='utf8',
        mysql_engine='InnoDB')
    op.create_table('tbl_luban_user',
                    sa.Column('id',
                              mysql.BIGINT(display_width=20, unsigned=True),
                              autoincrement=True,
                              nullable=False,
                              comment='自增ID'),
                    sa.Column('user_id',
                              mysql.VARCHAR(length=50),
                              server_default=sa.text("'none'"),
                              nullable=False,
                              comment='用户ID'),
                    sa.Column('user_name',
                              mysql.VARCHAR(length=50),
                              server_default=sa.text("'none'"),
                              nullable=False,
                              comment='用户名称'),
                    sa.Column('user_sex',
                              mysql.TINYINT(display_width=1),
                              server_default=sa.text("'0'"),
                              autoincrement=False,
                              nullable=False,
                              comment='用户性别(0-男,1-女)'),
                    sa.Column('user_status',
                              mysql.VARCHAR(length=10),
                              server_default=sa.text("'none'"),
                              nullable=False),
                    sa.Column('user_status1',
                              mysql.VARCHAR(length=10),
                              server_default=sa.text("'none'"),
                              nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    comment='广告路由表',
                    mysql_comment='广告路由表',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_index('uniq_user_id', 'tbl_luban_user', ['user_id'], unique=True)
    op.drop_table('article')