private static void migrateMeshNetwork11_12(@NonNull final SupportSQLiteDatabase database) {
        database.execSQL("CREATE TABLE `mesh_network_temp` " +
                "(`mesh_uuid` TEXT NOT NULL, " +
                " `mesh_name` TEXT, " +
                " `timestamp` INTEGER NOT NULL DEFAULT 0, " +
                " `partial` INTEGER NOT NULL DEFAULT 0," +
                " `iv_index` TEXT NOT NULL, " +
                " `network_exclusions` TEXT NOT NULL DEFAULT '{}', " +
                " `last_selected` INTEGER NOT NULL, " +
                "PRIMARY KEY(`mesh_uuid`))");
        final Cursor cursor = database.query("select * from mesh_network");
        if (cursor != null && cursor.moveToFirst()) {
            do {
                final String uuid = cursor.getString(cursor.getColumnIndex("mesh_uuid"));
                final String meshName = cursor.getString(cursor.getColumnIndex("mesh_name"));
                final long timestamp = cursor.getLong(cursor.getColumnIndex("timestamp"));
                final String ivIndex = cursor.getString(cursor.getColumnIndex("iv_index"));
                final String networkExclusions = cursor.getString(cursor.getColumnIndex("networkExclusions"));
                final int lastSelected = cursor.getInt(cursor.getColumnIndex("last_selected"));
                final ContentValues values = new ContentValues();
                values.put("mesh_uuid", uuid);
                values.put("mesh_name", meshName);
                values.put("timestamp", timestamp);
                values.put("iv_index", ivIndex);
                values.put("network_exclusions", networkExclusions);
                values.put("last_selected", lastSelected);
                database.insert("mesh_network_temp", SQLiteDatabase.CONFLICT_REPLACE, values);
            } while (cursor.moveToNext());
            cursor.close();
        }
        database.execSQL("DROP TABLE mesh_network");
        database.execSQL("ALTER TABLE mesh_network_temp RENAME TO mesh_network");
    }
Override the onOpen method to populate the database.
For this sample, we clear the database every time it is created or opened.
<p>
If you want to populate the database only when the database is created for the 1st time,
override RoomDatabase.Callback()#onCreate
mesh/src/main/java/no/nordicsemi/android/mesh/MeshNetworkDb.java