Skip to content

Commit

Permalink
fux migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
NeumimTo committed Jul 10, 2019
1 parent 7f2bc35 commit 82e05f6
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void preinit(GamePreInitializationEvent e) {
PluginCore.MANAGED_JPA_TYPES.add(JPABaseCharacterAttribute.class);
PluginCore.MANAGED_JPA_TYPES.add(JPACharacterSkill.class);
PluginCore.MANAGED_JPA_TYPES.add(JPACharacterClass.class);
Sponge.getEventManager().registerListeners(this, new PersistenceHandler());
Sponge.getEventManager().registerListeners(this, injector.getInstance(PersistenceHandler.class));
new NKeys();
DataRegistration.builder()
.manipulatorId("item_attribute_ref")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SpongeAssetService implements AssetService {
@Override
public String getAssetAsString(String path) {
try {
return Sponge.getAssetManager().getAsset(NtRpgPlugin.GlobalScope.plugin, "Skills-Definitions.conf").get().readString();
return Sponge.getAssetManager().getAsset(NtRpgPlugin.GlobalScope.plugin, path).get().readString();
} catch (IOException e) {
Log.error("Could not copy file Skills-Definition.conf into the directory " + ResourceLoader.addonDir, e);
throw new IllegalArgumentException(e);
Expand All @@ -26,7 +26,7 @@ public String getAssetAsString(String path) {

@Override
public void copyToFile(String s, Path toPath) {
Asset asset = Sponge.getAssetManager().getAsset(NtRpgPlugin.GlobalScope.plugin, "Skills-Definitions.conf").get();
Asset asset = Sponge.getAssetManager().getAsset(NtRpgPlugin.GlobalScope.plugin, s).get();
try {
asset.copyToFile(toPath);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ public void onFindDbSchemaMigrationsEvent(FindDbSchemaMigrationsEvent event) thr
List<String> migrations = Arrays.asList(
"sql/%s/040918-init-db.sql",
"sql/%s/060119-update-2.0.0.sql",
"sql/%s/240219-fix-null-levels.sql",
"sql/%s/250619-attrpoints-spent.sql"
"sql/%s/022419-fix-null-levels.sql",
"sql/%s/062519-attrpoints-spent.sql",
"sql/%s/071019-add-missing-columns.sql"
);

String s = dms.getDatabaseProductName().toLowerCase();
if (s.equalsIgnoreCase("mariadb")) {
s = "mysql";
}
for (String migration : migrations) {
migration = migration.replaceAll("%s", s);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
--@author:NeumimTo
--@date:24.02.2019 16:00
--@note:Level was null
update table rpg_character_class set level = 0 where level is null;
update rpg_character_class set level = 0 where level is null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--@id:add-attr-pointsspent
--@author:NeumimTo
--@date:25.06.2019 18:20
--@note:Add column for attribute points spent sum
alter table rpg_character_base add column attribute_points_spent int default 0;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--@id:add-missing-columns
--@author:NeumimTo
--@date:10.07.2019 23:00
--@note:Add some missing column
alter table rpg_character_attribute add column created timestamp not null default now();
alter table rpg_character_attribute add column updated timestamp not null default now();
alter table rpg_character_class add column updated timestamp not null default now();
alter table rpg_character_class add column created timestamp not null default now();
alter table rpg_character_skill add column created timestamp not null default now();
alter table rpg_character_skill add column updated timestamp not null default now();

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--@id:add-attr-pointsspent
--@author:NeumimTo
--@date:25.06.2019 18:20
--@note:Add column for attribute points spent sum
alter table rpg_character_base add column attribute_points_spent int default 0;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--@id:add-missing-columns
--@author:NeumimTo
--@date:10.07.2019 23:00
--@note:Add some missing column
alter table rpg_character_attribute add column created timestamp not null default now();
alter table rpg_character_attribute add column updated timestamp not null default now();
alter table rpg_character_class add column updated timestamp not null default now();
alter table rpg_character_class add column created timestamp not null default now();
alter table rpg_character_skill add column created timestamp not null default now();
alter table rpg_character_skill add column updated timestamp not null default now();

This file was deleted.

0 comments on commit 82e05f6

Please sign in to comment.