mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-02-23 21:14:22 +01:00
Extended batching, first draft
This commit is contained in:
@@ -64,9 +64,24 @@ CREATE TABLE recipient (
|
||||
address TEXT,
|
||||
amount REAL,
|
||||
tx_id INTEGER REFERENCES tx,
|
||||
inserted_ts INTEGER DEFAULT CURRENT_TIMESTAMP
|
||||
inserted_ts INTEGER DEFAULT CURRENT_TIMESTAMP,
|
||||
webhook_url TEXT,
|
||||
calledback INTEGER DEFAULT FALSE,
|
||||
calledback_ts INTEGER,
|
||||
batch_id INTEGER REFERENCES batch,
|
||||
label TEXT,
|
||||
);
|
||||
CREATE INDEX idx_recipient_address ON recipient (address);
|
||||
CREATE INDEX idx_recipient_label ON recipient (label);
|
||||
|
||||
CREATE TABLE batch (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
label TEXT UNIQUE,
|
||||
conf_target INTEGER,
|
||||
feerate REAL,
|
||||
inserted_ts INTEGER DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
INSERT INTO batch (id, label, conf_target, feerate) VALUES (1, "default", 6, NULL);
|
||||
|
||||
CREATE TABLE watching_by_txid (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
|
||||
0
proxy_docker/app/data/sqlmigrate20181213_0-0.1.sh
Normal file → Executable file
0
proxy_docker/app/data/sqlmigrate20181213_0-0.1.sh
Normal file → Executable file
0
proxy_docker/app/data/sqlmigrate20190104_0.1-0.2.sh
Normal file → Executable file
0
proxy_docker/app/data/sqlmigrate20190104_0.1-0.2.sh
Normal file → Executable file
0
proxy_docker/app/data/sqlmigrate20190130_0.1-0.2.sh
Normal file → Executable file
0
proxy_docker/app/data/sqlmigrate20190130_0.1-0.2.sh
Normal file → Executable file
0
proxy_docker/app/data/sqlmigrate20191127_0.2.4-0.3.0.sh
Normal file → Executable file
0
proxy_docker/app/data/sqlmigrate20191127_0.2.4-0.3.0.sh
Normal file → Executable file
14
proxy_docker/app/data/sqlmigrate20200610_0.4.0-0.5.0.sh
Executable file
14
proxy_docker/app/data/sqlmigrate20200610_0.4.0-0.5.0.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Checking for extended batching support in DB..."
|
||||
count=$(sqlite3 $DB_FILE "select count(*) from pragma_table_info('recipient') where name='batch_id'")
|
||||
if [ "${count}" -eq "0" ]; then
|
||||
# batch_id not there, we have to migrate
|
||||
echo "Migrating database for extended batching support..."
|
||||
echo "Backing up current DB..."
|
||||
cp $DB_FILE $DB_FILE-sqlmigrate20200610_0.4.0-0.5.0
|
||||
echo "Altering DB..."
|
||||
cat sqlmigrate20200610_0.4.0-0.5.0.sql | sqlite3 $DB_FILE
|
||||
else
|
||||
echo "Database extended batching support migration already done, skipping!"
|
||||
fi
|
||||
16
proxy_docker/app/data/sqlmigrate20200610_0.4.0-0.5.0.sql
Normal file
16
proxy_docker/app/data/sqlmigrate20200610_0.4.0-0.5.0.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
CREATE TABLE batch (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
label TEXT UNIQUE,
|
||||
conf_target INTEGER,
|
||||
feerate REAL,
|
||||
inserted_ts INTEGER DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
INSERT INTO batch (id, label, conf_target, feerate) VALUES (1, "default", 6, NULL);
|
||||
|
||||
ALTER TABLE recipient ADD COLUMN webhook_url TEXT;
|
||||
ALTER TABLE recipient ADD COLUMN batch_id INTEGER REFERENCES batch;
|
||||
ALTER TABLE recipient ADD COLUMN label INTEGER REFERENCES batch;
|
||||
ALTER TABLE recipient ADD COLUMN calledback INTEGER DEFAULT FALSE;
|
||||
ALTER TABLE recipient ADD COLUMN calledback_ts INTEGER;
|
||||
CREATE INDEX idx_recipient_label ON recipient (label);
|
||||
Reference in New Issue
Block a user