mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-06 07:32:46 +00:00
Implements better schema management
This commit is contained in:
@@ -20,7 +20,7 @@ import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Module;
|
||||
import com.l2jserver.model.id.provider.IDProviderModule;
|
||||
import com.l2jserver.service.ServiceModule;
|
||||
import com.l2jserver.service.database.JDBCDAOModule;
|
||||
import com.l2jserver.service.database.OrientDBDAOModule;
|
||||
|
||||
/**
|
||||
* The game server Google Guice {@link Module}.
|
||||
@@ -32,6 +32,6 @@ public class GameServerModule extends AbstractModule {
|
||||
protected void configure() {
|
||||
install(new ServiceModule());
|
||||
install(new IDProviderModule());
|
||||
install(new JDBCDAOModule());
|
||||
install(new OrientDBDAOModule());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.l2jserver.service.core.threading.ThreadServiceImpl;
|
||||
import com.l2jserver.service.core.vfs.Java7VFSService;
|
||||
import com.l2jserver.service.core.vfs.VFSService;
|
||||
import com.l2jserver.service.database.DatabaseService;
|
||||
import com.l2jserver.service.database.GameServerJDBCDatabaseService;
|
||||
import com.l2jserver.service.database.GameServerOrientDatabaseService;
|
||||
import com.l2jserver.service.game.AttackService;
|
||||
import com.l2jserver.service.game.AttackServiceImpl;
|
||||
import com.l2jserver.service.game.admin.AdministratorService;
|
||||
@@ -89,7 +89,7 @@ public class ServiceModule extends AbstractModule {
|
||||
bind(CacheService.class).to(SoftCacheService.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
|
||||
bind(DatabaseService.class).to(GameServerJDBCDatabaseService.class)
|
||||
bind(DatabaseService.class).to(GameServerOrientDatabaseService.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
bind(WorldIDService.class).to(CachedWorldIDService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
package com.l2jserver.service.database;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.model.game.CharacterShortcut.ShortcutType;
|
||||
@@ -112,17 +110,20 @@ public class GameServerJDBCDatabaseService extends AbstractSQLDatabaseService
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void ensureDatabaseSchema(Connection conn) throws SQLException,
|
||||
IOException {
|
||||
updateSchema(conn, QActorSkill.actorSkill);
|
||||
updateSchema(conn, QCharacter.character);
|
||||
updateSchema(conn, QCharacterFriend.characterFriend);
|
||||
updateSchema(conn, QCharacterShortcut.characterShortcut);
|
||||
updateSchema(conn, QClan.clan);
|
||||
updateSchema(conn, QItem.item);
|
||||
updateSchema(conn, QLogChat.logChat);
|
||||
if (updateSchema(conn, QNPC.npc)) {
|
||||
importData(vfsService.resolve("data/static/npc.csv"), QNPC.npc);
|
||||
public void updateSchemas() {
|
||||
updateSchema(QActorSkill.actorSkill);
|
||||
updateSchema(QCharacter.character);
|
||||
updateSchema(QCharacterFriend.characterFriend);
|
||||
updateSchema(QCharacterShortcut.characterShortcut);
|
||||
updateSchema(QClan.clan);
|
||||
updateSchema(QItem.item);
|
||||
updateSchema(QLogChat.logChat);
|
||||
if (updateSchema(QNPC.npc)) {
|
||||
try {
|
||||
importData(vfsService.resolve("data/static/npc.csv"), QNPC.npc);
|
||||
} catch (IOException e) {
|
||||
throw new DatabaseException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,20 +82,19 @@ public class GameServerOrientDatabaseService extends
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void ensureDatabaseSchema() {
|
||||
createSchema(QActorSkill.actorSkill);
|
||||
createSchema(QCharacter.character);
|
||||
createSchema(QCharacterFriend.characterFriend);
|
||||
createSchema(QCharacterShortcut.characterShortcut);
|
||||
createSchema(QClan.clan);
|
||||
createSchema(QItem.item);
|
||||
createSchema(QLogChat.logChat);
|
||||
if (createSchema(QNPC.npc)) {
|
||||
public void updateSchemas() {
|
||||
updateSchema(QActorSkill.actorSkill);
|
||||
updateSchema(QCharacter.character);
|
||||
updateSchema(QCharacterFriend.characterFriend);
|
||||
updateSchema(QCharacterShortcut.characterShortcut);
|
||||
updateSchema(QClan.clan);
|
||||
updateSchema(QItem.item);
|
||||
updateSchema(QLogChat.logChat);
|
||||
if (updateSchema(QNPC.npc)) {
|
||||
try {
|
||||
importData(Paths.get("data/static/npc.csv"), QNPC.npc);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
throw new DatabaseException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,15 +23,14 @@ public class QActorSkill extends RelationalPathBase<Skill> {
|
||||
@ColumnSize(10)
|
||||
public final NumberPath<Integer> actorId = createNumber("actor_id",
|
||||
Integer.class);
|
||||
@ColumnSize(6)
|
||||
public final NumberPath<Integer> skillId = createNumber("skill_id",
|
||||
Integer.class);
|
||||
|
||||
@ColumnSize(4)
|
||||
public final NumberPath<Integer> level = createNumber("level",
|
||||
Integer.class);
|
||||
|
||||
@ColumnSize(6)
|
||||
public final NumberPath<Integer> skillId = createNumber("skill_id",
|
||||
Integer.class);
|
||||
|
||||
public final PrimaryKey<Skill> primary = createPrimaryKey(actorId, skillId);
|
||||
|
||||
public QActorSkill(String variable) {
|
||||
|
||||
Reference in New Issue
Block a user