public void run(H2ConnectionFactory newFactory) throws Exception {
            Path oldDatabase = this.directory.resolve("luckperms-h2");
            Path oldDatabaseWriteFile = this.directory.resolve("luckperms-h2.mv.db");

            if (!Files.exists(oldDatabaseWriteFile)) {
                return;
            }

            Path tempMigrationFile = this.directory.resolve("luckperms-h2-migration.sql");

            this.plugin.getLogger().warn("[DB Upgrade] Found an old (v1) H2 database file. LuckPerms will now attempt to upgrade it to v2 (this is a one time operation).");

            try {
                Files.deleteIfExists(tempMigrationFile);
            } catch (IOException e) {
                this.plugin.getLogger().warn("[DB Upgrade] Unable to delete temporary data from a previous migration attempt", e);
            }

            this.plugin.getLogger().info("[DB Upgrade] Stage 1: Exporting the old database to an intermediary file...");
            Constructor<?> constructor = getConnectionConstructor();
            try (Connection c = getConnection(constructor, oldDatabase)) {
                try (Statement stmt = c.createStatement()) {
                    stmt.execute(String.format("SCRIPT TO '%s'", tempMigrationFile));
                }
            }

            this.plugin.getLogger().info("[DB Upgrade] Stage 2: Importing the intermediary file into the new database...");
            try (Connection c = newFactory.getConnection()) {
                try (Statement stmt = c.createStatement()) {
                    stmt.execute(String.format("RUNSCRIPT FROM '%s'", tempMigrationFile));
                }
            }

            this.plugin.getLogger().info("[DB Upgrade] Stage 3: Tidying up...");
            Files.deleteIfExists(tempMigrationFile);
            Files.move(oldDatabaseWriteFile, this.directory.resolve("luckperms-h2-v1-backup.mv.db"));

            this.plugin.getLogger().info("[DB Upgrade] All done!");
        }
Migrates the old (version 1) H2 database to version 2.

See <a href="http://www.h2database.com/html/migration-to-v2.html">here</a> for more info.
common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/file/H2ConnectionFactory.java