mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-23 20:36:44 +00:00
upgrade to h2 HEAD
This commit is contained in:
parent
9ebabecfbe
commit
ab41f2e80e
6 changed files with 13 additions and 10 deletions
|
@ -44,13 +44,13 @@ dependencies {
|
|||
}
|
||||
implementation('com.google.guava:guava:28.2-jre')
|
||||
implementation('com.google.code.gson:gson:2.8.6')
|
||||
implementation('com.h2database:h2:1.4.200')
|
||||
implementation('com.h2database:h2:1.4.201-SNAPSHOT')
|
||||
implementation('com.zaxxer:HikariCP:4.0.3')
|
||||
implementation('org.jdbi:jdbi3-core:3.20.0') {
|
||||
exclude group: 'org.slf4j'
|
||||
}
|
||||
implementation('org.jdbi:jdbi3-sqlobject:3.20.0')
|
||||
implementation('org.flywaydb:flyway-core:7.9.1')
|
||||
implementation('org.flywaydb:flyway-core:7.10.1-SNAPSHOT')
|
||||
implementation('org.fxmisc.richtext:richtextfx:0.10.4')
|
||||
implementation('no.tornado:tornadofx-controls:1.0.4')
|
||||
implementation('com.google.zxing:javase:3.4.0')
|
||||
|
|
|
@ -321,7 +321,7 @@ public class Hwi {
|
|||
|
||||
private File getHwiHomeDir() {
|
||||
if(Platform.getCurrent() == Platform.OSX) {
|
||||
return new File(Storage.getSparrowHome(), HWI_HOME_DIR);
|
||||
return new File(Storage.getSparrowDir(), HWI_HOME_DIR);
|
||||
}
|
||||
|
||||
return new File(System.getProperty("java.io.tmpdir"));
|
||||
|
|
|
@ -14,7 +14,7 @@ public class BlockTransactionHashIndexMapper implements RowMapper<BlockTransacti
|
|||
public BlockTransactionHashIndex map(ResultSet rs, StatementContext ctx) throws SQLException {
|
||||
BlockTransactionHashIndex blockTransactionHashIndex = new BlockTransactionHashIndex(Sha256Hash.wrap(rs.getBytes("blockTransactionHashIndex.hash")),
|
||||
rs.getInt("blockTransactionHashIndex.height"), rs.getTimestamp("blockTransactionHashIndex.date"), rs.getLong("blockTransactionHashIndex.fee"),
|
||||
rs.getLong("blockTransactionHashIndex.index"), rs.getLong("blockTransactionHashIndex.value"), null, rs.getString("blockTransactionHashIndex.label"));
|
||||
rs.getLong("blockTransactionHashIndex.index"), rs.getLong("blockTransactionHashIndex.outputValue"), null, rs.getString("blockTransactionHashIndex.label"));
|
||||
blockTransactionHashIndex.setId(rs.getLong("blockTransactionHashIndex.id"));
|
||||
int statusIndex = rs.getInt("blockTransactionHashIndex.status");
|
||||
if(!rs.wasNull()) {
|
||||
|
|
|
@ -306,8 +306,11 @@ public class DbPersistence implements Persistence {
|
|||
|
||||
private void cleanAndMigrate(Storage storage, String schema, String password) throws StorageException {
|
||||
try {
|
||||
boolean existing = (dataSource == null);
|
||||
Flyway flyway = getFlyway(storage, schema, password);
|
||||
flyway.clean();
|
||||
if(existing) {
|
||||
flyway.clean();
|
||||
}
|
||||
flyway.migrate();
|
||||
} catch(FlywayException e) {
|
||||
log.error("Failed to save wallet file.", e);
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
|||
public interface WalletNodeDao {
|
||||
@SqlQuery("select walletNode.id, walletNode.derivationPath, walletNode.label, walletNode.parent, " +
|
||||
"blockTransactionHashIndex.id, blockTransactionHashIndex.hash, blockTransactionHashIndex.height, blockTransactionHashIndex.date, blockTransactionHashIndex.fee, blockTransactionHashIndex.label, " +
|
||||
"blockTransactionHashIndex.index, blockTransactionHashIndex.value, blockTransactionHashIndex.status, blockTransactionHashIndex.spentBy, blockTransactionHashIndex.node " +
|
||||
"blockTransactionHashIndex.index, blockTransactionHashIndex.outputValue, blockTransactionHashIndex.status, blockTransactionHashIndex.spentBy, blockTransactionHashIndex.node " +
|
||||
"from walletNode left join blockTransactionHashIndex on walletNode.id = blockTransactionHashIndex.node where walletNode.wallet = ? order by walletNode.parent asc nulls first, blockTransactionHashIndex.spentBy asc nulls first")
|
||||
@RegisterRowMapper(WalletNodeMapper.class)
|
||||
@RegisterRowMapper(BlockTransactionHashIndexMapper.class)
|
||||
|
@ -28,11 +28,11 @@ public interface WalletNodeDao {
|
|||
@GetGeneratedKeys("id")
|
||||
long insertWalletNode(String derivationPath, String label, long wallet, Long parent);
|
||||
|
||||
@SqlUpdate("insert into blockTransactionHashIndex (hash, height, date, fee, label, index, value, status, spentBy, node) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
|
||||
@SqlUpdate("insert into blockTransactionHashIndex (hash, height, date, fee, label, index, outputValue, status, spentBy, node) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
|
||||
@GetGeneratedKeys("id")
|
||||
long insertBlockTransactionHashIndex(byte[] hash, int height, Date date, Long fee, String label, long index, long value, Integer status, Long spentBy, long node);
|
||||
|
||||
@SqlUpdate("update blockTransactionHashIndex set hash = ?, height = ?, date = ?, fee = ?, label = ?, index = ?, value = ?, status = ?, spentBy = ?, node = ? where id = ?")
|
||||
@SqlUpdate("update blockTransactionHashIndex set hash = ?, height = ?, date = ?, fee = ?, label = ?, index = ?, outputValue = ?, status = ?, spentBy = ?, node = ? where id = ?")
|
||||
void updateBlockTransactionHashIndex(byte[] hash, int height, Date date, Long fee, String label, long index, long value, Integer status, Long spentBy, long node, long id);
|
||||
|
||||
@SqlUpdate("update walletNode set label = :label where id = :id")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
create table blockTransaction (id identity not null, txid binary(32) not null, hash binary(32) not null, height integer not null, date timestamp, fee bigint, label varchar(255), transaction binary, blockHash binary(32), wallet bigint not null);
|
||||
create table blockTransactionHashIndex (id identity not null, hash binary(32) not null, height integer not null, date timestamp, fee bigint, label varchar(255), index bigint not null, value bigint not null, status integer, spentBy bigint, node bigint not null);
|
||||
create table blockTransaction (id identity not null, txid binary(32) not null, hash binary(32) not null, height integer not null, date timestamp, fee bigint, label varchar(255), transaction binary(1048576), blockHash binary(32), wallet bigint not null);
|
||||
create table blockTransactionHashIndex (id identity not null, hash binary(32) not null, height integer not null, date timestamp, fee bigint, label varchar(255), index bigint not null, outputValue bigint not null, status integer, spentBy bigint, node bigint not null);
|
||||
create table keystore (id identity not null, label varchar(255), source integer not null, walletModel integer not null, masterFingerprint varchar(8), derivationPath varchar(255) not null, extendedPublicKey varchar(255), masterPrivateExtendedKey bigint, seed bigint, wallet bigint not null, index integer not null);
|
||||
create table masterPrivateExtendedKey (id identity not null, privateKey binary(255), chainCode binary(255), initialisationVector binary(255), encryptedBytes binary(255), keySalt binary(255), deriver integer, crypter integer, creationTimeSeconds bigint);
|
||||
create table policy (id identity not null, name varchar(255) not null, script varchar(2048) not null);
|
||||
|
|
Loading…
Reference in a new issue