feat: update addresses and wallets table; add config table

This commit is contained in:
Vlad Stan 2022-07-04 17:36:06 +03:00
parent a2f48de583
commit 8e4e0bdf2d

View file

@ -34,3 +34,50 @@ async def m001_initial(db):
);
"""
)
async def m002_add_columns_to_adresses(db):
"""
Add 'branch_index', 'address_index', 'has_activity' and 'note' columns to the 'addresses' table
"""
await db.execute(
"ALTER TABLE watchonly.addresses ADD COLUMN branch_index INTEGER NOT NULL DEFAULT 0;"
)
await db.execute(
"ALTER TABLE watchonly.addresses ADD COLUMN address_index INTEGER NOT NULL DEFAULT 0;"
)
await db.execute(
"ALTER TABLE watchonly.addresses ADD COLUMN has_activity BOOLEAN DEFAULT false;"
)
await db.execute("ALTER TABLE watchonly.addresses ADD COLUMN note TEXT;")
async def m003_add_columns_to_wallets(db):
"""
Add 'type' and 'fingerprint' columns to the 'wallets' table
"""
await db.execute("ALTER TABLE watchonly.wallets ADD COLUMN type TEXT;")
await db.execute(
"ALTER TABLE watchonly.wallets ADD COLUMN fingerprint TEXT NOT NULL;"
)
async def m004_create_config_table(db):
"""
Allow the extension to persist and retrieve any number of config values.
Each user has its configurations saved as a JSON string
"""
await db.execute(
"""CREATE TABLE watchonly.config (
"user" TEXT NOT NULL,
json_data TEXT NOT NULL
);"""
)
### TODO: fix statspay dependcy first
# await db.execute(
# "DROP TABLE watchonly.wallets;"
# )