def downgrade(migrate_engine):
    meta.bind = migrate_engine
    try:
        position = Table("position", meta, autoload=True)
        Column("pending_transfer").drop(position)
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)
def upgrade(migrate_engine):
    meta.bind = migrate_engine
    try:
        table.create()
    except sqlalchemy.exc.ProgrammingError as err:
        # NOTE: If the TBL already exists, output a WARNING message.
        LOG.warning(err.orig)
def downgrade(migrate_engine):
    meta.bind = migrate_engine
    try:
        listing = Table("listing", meta, autoload=True)
        Column("is_public").drop(listing)
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)
def upgrade(migrate_engine):
    meta.bind = migrate_engine
    try:
        private_listing = Table("private_listing", meta, autoload=True)
        private_listing.drop()
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)
def downgrade(migrate_engine):
    meta.bind = migrate_engine
    try:
        order = Table("order", meta, autoload=True)
        Column("counterpart_address").drop(order)
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)
示例#6
0
def downgrade(migrate_engine):
    meta.bind = migrate_engine
    try:
        listing = Table("listing", meta, autoload=True)
        Column("payment_method_credit_card", Boolean).create(listing)
        Column("payment_method_bank", Boolean).create(listing)
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)
def upgrade(migrate_engine):
    meta.bind = migrate_engine
    try:
        private_listing = Table("private_listing", meta, autoload=True)
        Column("payment_method_credit_card").drop(private_listing)
        Column("payment_method_bank").drop(private_listing)
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)
def downgrade(migrate_engine):
    meta.bind = migrate_engine

    try:
        listing_table = Table("listing", meta)
        Column("owner_address").drop(listing_table)
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にカラムが削除されている場合はWARNINGを出力する
        LOG.warning(err.orig)

    try:
        private_listing_table = Table("private_listing", meta)
        Column("owner_address").drop(private_listing_table)
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にカラムが削除されている場合はWARNINGを出力する
        LOG.warning(err.orig)
def upgrade(migrate_engine):
    meta.bind = migrate_engine

    try:
        listing_table = Table("listing", meta)
        Column("owner_address", String(256)).create(listing_table)
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にカラムが存在する場合はWARNINGを出力する
        LOG.warning(err.orig)

    try:
        private_listing_table = Table("private_listing", meta)
        Column("owner_address", String(256)).create(private_listing_table)
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にカラムが存在する場合はWARNINGを出力する
        LOG.warning(err.orig)
def downgrade(migrate_engine):
    meta.bind = migrate_engine

    try:
        notification_table = Table("notification", meta)
        Column("id").drop(notification_table)
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にカラムが削除されている場合はWARNINGを出力する
        LOG.warning(err.orig)

    if engine.name != "mysql":
        try:
            notification_id_seq.drop(bind=migrate_engine)
        except sqlalchemy.exc.ProgrammingError as err:
            LOG.warning(err.orig)
def downgrade(migrate_engine):
    meta.bind = migrate_engine

    private_listing = Table(
        "private_listing", meta,
        Column("id", BigInteger, primary_key=True, autoincrement=True),
        Column("token_address", String(256), index=True),
        Column("max_holding_quantity", BigInteger),
        Column("max_sell_amount", BigInteger),
        Column("created", DateTime, default=datetime.utcnow),
        Column("modified",
               DateTime,
               default=datetime.utcnow,
               onupdate=datetime.utcnow))
    try:
        private_listing.create()
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にTBLが存在する場合はWARNINGを出力する
        LOG.warning(err.orig)
def upgrade(migrate_engine):
    meta.bind = migrate_engine

    try:
        notification_table = Table("notification", meta)
        if engine.name != "mysql":
            try:
                notification_id_seq.create(bind=migrate_engine)
            except sqlalchemy.exc.ProgrammingError as err:
                LOG.warning(err.orig)

            col = Column(
                "id",
                BigInteger,
                server_default=notification_id_seq.next_value(),
                autoincrement=True
            )
        else:
            col = Column(
                "id",
                BigInteger,
                autoincrement=True
            )
        col.create(notification_table)
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にカラムが存在する場合はWARNINGを出力する
        LOG.warning(err.orig)
    except pymysql.err.OperationalError as err:  # NOTE: 既にカラムが存在する場合はWARNINGを出力する(MySQLの場合)
        LOG.warning(err)
示例#13
0
def downgrade(migrate_engine):
    meta.bind = migrate_engine

    try:
        order = Table("order", meta, autoload=True)
        order.c.token_address.alter(type=String(256), index=True)
        order.c.exchange_address.alter(type=String(256), index=True)
        order.c.account_address.alter(type=String(256))
        order.c.agent_address.alter(type=String(256))
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)

    try:
        order = Table("order", meta, autoload=True)
        Column("transaction_hash").drop(order)
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)

    try:
        order = Table("order", meta, autoload=True)
        Column("order_timestamp").drop(order)
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)
示例#14
0
def upgrade(migrate_engine):
    meta.bind = migrate_engine

    try:
        order = Table("order", meta, autoload=True)
        order.c.token_address.alter(type=String(42), index=True)
        order.c.exchange_address.alter(type=String(42), index=True)
        order.c.account_address.alter(type=String(42))
        order.c.agent_address.alter(type=String(42))
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)

    try:
        order = Table("order", meta, autoload=True)
        Column("transaction_hash", String(66)).create(order)
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にカラムが存在する場合はWARNINGを出力する
        LOG.warning(err.orig)

    try:
        order = Table("order", meta, autoload=True)
        Column("order_timestamp", DateTime, default=None).create(order)
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にカラムが存在する場合はWARNINGを出力する
        LOG.warning(err.orig)
示例#15
0
def downgrade(migrate_engine):
    meta.bind = migrate_engine

    try:
        agreement = Table("agreement", meta, autoload=True)
        agreement.c.exchange_address.alter(type=String(256), index=True)
        agreement.c.buyer_address.alter(type=String(256), index=True)
        agreement.c.seller_address.alter(type=String(256), index=True)
        agreement.c.counterpart_address.alter(type=String(256))
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)

    try:
        agreement = Table("agreement", meta, autoload=True)
        Column("transaction_hash").drop(agreement)
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)

    try:
        agreement = Table("agreement", meta, autoload=True)
        Column("agreement_timestamp").drop(agreement)
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)
示例#16
0
def upgrade(migrate_engine):
    meta.bind = migrate_engine

    try:
        agreement = Table("agreement", meta, autoload=True)
        agreement.c.exchange_address.alter(type=String(42), index=True)
        agreement.c.buyer_address.alter(type=String(42), index=True)
        agreement.c.seller_address.alter(type=String(42), index=True)
        agreement.c.counterpart_address.alter(type=String(42))
    except sqlalchemy.exc.ProgrammingError as err:
        LOG.warning(err.orig)

    try:
        agreement = Table("agreement", meta, autoload=True)
        Column("transaction_hash", String(66)).create(agreement)
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にカラムが存在する場合はWARNINGを出力する
        LOG.warning(err.orig)

    try:
        agreement = Table("agreement", meta, autoload=True)
        Column("agreement_timestamp", DateTime, default=None).create(agreement)
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にカラムが存在する場合はWARNINGを出力する
        LOG.warning(err.orig)
示例#17
0
def upgrade(migrate_engine):
    meta.bind = migrate_engine
    try:
        table.create()
    except sqlalchemy.exc.ProgrammingError as err:  # NOTE: 既にTBLが存在する場合はWARNINGを出力する
        LOG.warning(err.orig)
def downgrade(migrate_engine):
    meta.bind = migrate_engine
    try:
        table.drop()
    except Exception as err:
        LOG.warning(err)