def migrate(conn, tables):
    update_tables_priority = [
        "Event",
        "PartCodeQuantity",
    ]

    for table in update_tables_priority:
        if len(tables[table]["fields_Common"]) == 0:
            continue

        str_common_fields = ", ".join(tables[table]["fields_Common"])
        insert_str = "INSERT OR REPLACE INTO {} ({}) SELECT {} FROM old.{};"
        stmt = insert_str.format(table, str_common_fields, str_common_fields, table)
        conn.query(stmt)
