def METHOD_NAME(engine, diffs, table_names, adapters_by_table):
    migration_diffs = [diff for diff in diffs if diff.table_name in table_names]
    for table in table_names:
        adapter = adapters_by_table[table]
        pillow_logging.info("[rebuild] Using config: %r", adapter.config)
        pillow_logging.info("[rebuild] sqlalchemy metadata: %r", get_metadata(adapter.engine_id).tables[table])
        pillow_logging.info("[rebuild] sqlalchemy table: %r", adapter.get_table())
    changes = migrate_tables(engine, migration_diffs)
    for table, diffs in changes.items():
        adapter = adapters_by_table[table]
        pillow_logging.info(
            "[rebuild] Migrating table: %s, from config %s at rev %s",
            table, adapter.config._id, adapter.config._rev
        )
        adapter.log_table_migrate(source='pillowtop', diffs=diffs)