mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Add MySQL migration script
This commit is contained in:
1 parent
f9a275a145
commit
464b1ac202
2 files changed
+84
-3
No files matched your search
@@ -85,7 +85,7 @@ public class LegacyMigrator extends Migrator {
|
||||
"%target_homes_table%", plugin.getSettings().getTableName(Settings.TableName.HOME_DATA),
|
||||
"%source_warps_table%", sourceWarpsDataTable,
|
||||
"%target_warps_table%", plugin.getSettings().getTableName(Settings.TableName.WARP_DATA)))
|
||||
.thenRun(() -> plugin.getLoggingAdapter().log(Level.INFO, "Migration complete!"))
|
||||
.thenRun(() -> plugin.getLoggingAdapter().log(Level.INFO, "SQLite Migration complete!"))
|
||||
.exceptionally(e -> {
|
||||
plugin.getLoggingAdapter().log(Level.SEVERE, "Migration of SQLite database failed!", e);
|
||||
return null;
|
||||
@@ -93,8 +93,24 @@ public class LegacyMigrator extends Migrator {
|
||||
}
|
||||
|
||||
private void migrateMySqlDatabase() {
|
||||
plugin.getLoggingAdapter().log(Level.INFO, "Migrating same MySQL database...");
|
||||
//todo write script
|
||||
plugin.getLoggingAdapter().log(Level.INFO, "Migrating MySQL database, please wait... This may take a while!");
|
||||
|
||||
// Execute the migration script
|
||||
plugin.getDatabase().runScript(Objects.requireNonNull(plugin.getResource("migrator/mysql_migrator.sql")),
|
||||
Map.of("%target_positions_table%", plugin.getSettings().getTableName(Settings.TableName.POSITION_DATA),
|
||||
"%source_positions_table%", sourceLocationsDataTable,
|
||||
"%target_users_table%", plugin.getSettings().getTableName(Settings.TableName.PLAYER_DATA),
|
||||
"%source_users_table%", sourcePlayerDataTable,
|
||||
"%target_saved_positions%", plugin.getSettings().getTableName(Settings.TableName.SAVED_POSITION_DATA),
|
||||
"%source_homes_table%", sourceHomesDataTable,
|
||||
"%target_homes_table%", plugin.getSettings().getTableName(Settings.TableName.HOME_DATA),
|
||||
"%source_warps_table%", sourceWarpsDataTable,
|
||||
"%target_warps_table%", plugin.getSettings().getTableName(Settings.TableName.WARP_DATA)))
|
||||
.thenRun(() -> plugin.getLoggingAdapter().log(Level.INFO, "MySQL Migration complete!"))
|
||||
.exceptionally(e -> {
|
||||
plugin.getLoggingAdapter().log(Level.SEVERE, "Migration of MySQL database failed!", e);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user