mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
changed DB from SQLite to H2
This commit is contained in:
parent
8619dd6266
commit
d3046a9a0d
4 changed files with 9 additions and 7 deletions
|
@ -23,9 +23,10 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
<version>3.7.2</version>
|
<version>1.4.178</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.j256.ormlite</groupId>
|
<groupId>com.j256.ormlite</groupId>
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class CardInfo {
|
||||||
protected String supertypes;
|
protected String supertypes;
|
||||||
@DatabaseField
|
@DatabaseField
|
||||||
protected String manaCosts;
|
protected String manaCosts;
|
||||||
@DatabaseField
|
@DatabaseField(dataType = DataType.STRING, width = 500)
|
||||||
protected String rules;
|
protected String rules;
|
||||||
@DatabaseField
|
@DatabaseField
|
||||||
protected boolean black;
|
protected boolean black;
|
||||||
|
|
|
@ -53,7 +53,7 @@ public enum CardRepository {
|
||||||
|
|
||||||
instance;
|
instance;
|
||||||
|
|
||||||
private static final String JDBC_URL = "jdbc:sqlite:db/cards.db";
|
private static final String JDBC_URL = "jdbc:h2:file:./db/cards.h2";
|
||||||
private static final String VERSION_ENTITY_NAME = "card";
|
private static final String VERSION_ENTITY_NAME = "card";
|
||||||
private static final long CARD_DB_VERSION = 33;
|
private static final long CARD_DB_VERSION = 33;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ public enum ExpansionRepository {
|
||||||
|
|
||||||
instance;
|
instance;
|
||||||
|
|
||||||
private static final String JDBC_URL = "jdbc:sqlite:db/cards.db";
|
private static final String JDBC_URL = "jdbc:h2:file:./db/cards.h2";
|
||||||
private static final String VERSION_ENTITY_NAME = "expansion";
|
private static final String VERSION_ENTITY_NAME = "expansion";
|
||||||
private static final long EXPANSION_DB_VERSION = 3;
|
private static final long EXPANSION_DB_VERSION = 3;
|
||||||
|
|
||||||
|
@ -43,13 +43,14 @@ public enum ExpansionRepository {
|
||||||
TableUtils.createTableIfNotExists(connectionSource, ExpansionInfo.class);
|
TableUtils.createTableIfNotExists(connectionSource, ExpansionInfo.class);
|
||||||
expansionDao = DaoManager.createDao(connectionSource, ExpansionInfo.class);
|
expansionDao = DaoManager.createDao(connectionSource, ExpansionInfo.class);
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(ExpansionInfo expansion) {
|
public void add(ExpansionInfo expansion) {
|
||||||
try {
|
try {
|
||||||
expansionDao.create(expansion);
|
expansionDao.create(expansion);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue