def upgrade(migrate_engine):
    meta = MetaData(bind=migrate_engine)

    #939
    core_device = Table(Device.__tablename__, meta, autoload=True)
    core_device.c.address.alter(type=String(255))

    #1064
    core_plugin_config = Table(PluginConfig.__tablename__, meta, autoload=True)
    if not database_utils.column_exists(migrate_engine, PluginConfig.__tablename__, 'id'):
        core_plugin_config.c.name.alter(name='id')

    #1110
    core_device_type = Table(DeviceType.__tablename__, meta, autoload=True)
    core_device_type.c.name.alter(type=String(80))
    
    #1061
    core_device_stats = Table(DeviceStats.__tablename__, meta, autoload=True)
    if not database_utils.index_exists(migrate_engine, DeviceStats.__tablename__, 'ix_core_device_stats_skey'):
        Index('ix_core_device_stats_skey', core_device_stats.c.skey).create()
    
    #1274
    core_device_stats = Table(DeviceStats.__tablename__, meta, autoload=True)
    if not database_utils.index_exists(migrate_engine, DeviceStats.__tablename__, 'ix_core_device_stats_date_skey_device_id'):
        Index('ix_core_device_stats_date_skey_device_id', core_device_stats.c.date, core_device_stats.c.skey, 
                                                          core_device_stats.c.device_id).create()
def upgrade(migrate_engine):
    meta = MetaData(bind=migrate_engine)

    #939
    core_device = Table(Device.__tablename__, meta, autoload=True)
    core_device.c.address.alter(type=String(255))

    #1064
    core_plugin_config = Table(PluginConfig.__tablename__, meta, autoload=True)
    if not database_utils.column_exists(migrate_engine,
                                        PluginConfig.__tablename__, 'id'):
        core_plugin_config.c.name.alter(name='id')

    #1110
    core_device_type = Table(DeviceType.__tablename__, meta, autoload=True)
    core_device_type.c.name.alter(type=String(80))

    #1061
    core_device_stats = Table(DeviceStats.__tablename__, meta, autoload=True)
    if not database_utils.index_exists(migrate_engine,
                                       DeviceStats.__tablename__,
                                       'ix_core_device_stats_skey'):
        Index('ix_core_device_stats_skey', core_device_stats.c.skey).create()

    #1274
    core_device_stats = Table(DeviceStats.__tablename__, meta, autoload=True)
    if not database_utils.index_exists(
            migrate_engine, DeviceStats.__tablename__,
            'ix_core_device_stats_date_skey_device_id'):
        Index('ix_core_device_stats_date_skey_device_id',
              core_device_stats.c.date, core_device_stats.c.skey,
              core_device_stats.c.device_id).create()
def upgrade(migrate_engine):
    meta = MetaData(bind=migrate_engine)

    #1424
    core_device_stats = Table(DeviceStats.__tablename__, meta, autoload=True)
    if not database_utils.index_exists(migrate_engine, DeviceStats.__tablename__, 'ix_core_device_stats_date'):
        Index('ix_core_device_stats_date', core_device_stats.c.date).create()
Ejemplo n.º 4
0
def upgrade(migrate_engine):
    meta = MetaData(bind=migrate_engine)

    #1424
    core_device_stats = Table(DeviceStats.__tablename__, meta, autoload=True)
    if not database_utils.index_exists(migrate_engine,
                                       DeviceStats.__tablename__,
                                       'ix_core_device_stats_date'):
        Index('ix_core_device_stats_date', core_device_stats.c.date).create()