Add wallet_type column to distinguish exchanges from wallets
Exchanges (can receive bank deposits) vs wallets (cold storage only). Supports ?type= filter on GET /api/wallets. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
ALTER TABLE wallets DROP COLUMN wallet_type;
|
||||
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE wallets ADD COLUMN wallet_type TEXT NOT NULL DEFAULT 'exchange';
|
||||
--;;
|
||||
UPDATE wallets SET wallet_type = 'wallet'
|
||||
WHERE name IN ('Cold', 'Coldcard', 'Nunchuk Multi Sig');
|
||||
@@ -70,15 +70,19 @@ SELECT rate_date, eur, dkk, eur_dkk, updated_at FROM currencies WHERE rate_date
|
||||
|
||||
-- :name insert-wallet! :! :n
|
||||
-- :doc Insert a new wallet
|
||||
INSERT INTO wallets (name) VALUES (:name)
|
||||
INSERT INTO wallets (name, wallet_type) VALUES (:name, :wallet-type)
|
||||
|
||||
-- :name get-all-wallets :? :*
|
||||
-- :doc Get all wallets
|
||||
SELECT id, name, created_at FROM wallets ORDER BY name
|
||||
SELECT id, name, wallet_type, created_at FROM wallets ORDER BY name
|
||||
|
||||
-- :name get-wallets-by-type :? :*
|
||||
-- :doc Get wallets filtered by type
|
||||
SELECT id, name, wallet_type, created_at FROM wallets WHERE wallet_type = :wallet-type ORDER BY name
|
||||
|
||||
-- :name get-wallet-by-id :? :1
|
||||
-- :doc Get a wallet by ID
|
||||
SELECT id, name, created_at FROM wallets WHERE id = :id
|
||||
SELECT id, name, wallet_type, created_at FROM wallets WHERE id = :id
|
||||
|
||||
-- Events --------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user