feat: update SQLite to Postgre conversion scripts

This commit is contained in:
Vlad Stan 2022-07-12 08:32:09 +03:00
parent 3f51117ea9
commit c1f6845ad9

View file

@ -283,22 +283,24 @@ def migrate_ext(sqlite_db_file, schema, ignore_missing=True):
masterpub,
title,
address_no,
balance
balance,
type,
fingerprint
)
VALUES (%s, %s, %s, %s, %s, %s);
VALUES (%s, %s, %s, %s, %s, %s, %s, %s);
"""
insert_to_pg(q, res.fetchall())
# ADDRESSES
res = sq.execute("SELECT * FROM addresses;")
q = f"""
INSERT INTO watchonly.addresses (id, address, wallet, amount)
VALUES (%s, %s, %s, %s);
INSERT INTO watchonly.addresses (id, address, wallet, amount, branch_index, address_index, has_activity, note)
VALUES (%s, %s, %s, %s, %s, %s, %s::boolean, %s);
"""
insert_to_pg(q, res.fetchall())
# MEMPOOL
res = sq.execute("SELECT * FROM mempool;")
# CONFIG
res = sq.execute("SELECT * FROM config;")
q = f"""
INSERT INTO watchonly.mempool ("user", endpoint)
INSERT INTO watchonly.config ("user", json_data)
VALUES (%s, %s);
"""
insert_to_pg(q, res.fetchall())