Repository navigation
Commit 226e82e
feat(wallet-toolbox): run StorageKnex on Postgres (#719)
* fix(wallet-toolbox): accept Postgres as a storage dbtype
Add 'Postgres' to DBType, TableSettings.dbtype and the remote settings
validator. Postgres dates use Date objects, as on MySQL.
* fix(wallet-toolbox): run Knex migrations on Postgres
- determineDBType returns 'Postgres' for the postgresql dialect without
sending the MySQL VERSION() probe.
- The initial migration skips binary(len) widening on Postgres.
- Quote activeStorage in the 2025-02-22-001 raw update.
- Create sync_transfer_parts.bytes as bytea on Postgres.
* fix(wallet-toolbox): run StorageKnex queries on Postgres
- Return generated ids with RETURNING on Postgres.
- Alias count(*) in getCount and convert it with Number().
- Use ?? bindings for camelCase identifiers in raw SQL fragments.
- Bind spendable as a boolean in purgeData.
- Take the prepared-BEEF epoch and sync-state row locks on Postgres too.
- Add Setup.createPostgresKnex and Setup.postgresAfterCreate, which parse
int8 values as numbers per connection.
* fix(wallet-toolbox): portable session merges and Postgres duplicate keys
KnexSessionManager no longer compares boolean columns with integers when
merging equal-timestamp updates. The merge result is unchanged. Treat
Postgres error 23505 as a duplicate key in the session and payment replay
stores.
* test(wallet-toolbox): run Knex suites against Postgres with RUNPOSTGRES
Add pg as a dev dependency. RUNPOSTGRES and POSTGRES_CONNECTION add a
Postgres store wherever the suites add a MySQL store under RUNMYSQL;
missing test databases are created. Add a Postgres test for the Knex
remoting stores.
* docs(wallet-toolbox): document Postgres storage
* fix(wallet-toolbox): parse Postgres int8 per connection in StorageKnex
* fix(wallet-toolbox): keep Postgres transactions usable under READ COMMITTED
* test(wallet-toolbox): pass the Knex suites with a second backend
* fix(wallet-toolbox): keep rejecting Postgres in ChaintracksStorageKnex
* feat(wallet-toolbox): run adminStats and admin req review on Postgres
* feat(wallet-toolbox): accept a Postgres connection in MonitorDaemon
* feat(wallet-toolbox): build Postgres migration indexes concurrently
* ci(wallet-toolbox): run the Knex storage suites against Postgres
* chore(wallet-infra): sync the KnexPaymentReplayStore runtime copy
* chore(wallet-toolbox): prepare 2.15.0 release notes for Postgres storage
* docs(wallet-toolbox): regenerate API docs
* docs(wallet-toolbox): describe Postgres migrations and monitor setup
* test(wallet-toolbox): use new rows in the TxLabelMap mismatch test
* test(wallet-toolbox): age the req review fixture with the server clock
The MySQL driver writes Dates in the client time zone, so a client and server in
different zones shifted hoursOld by the offset.
* test(wallet-toolbox): trim trailing spaces from createAction2 database names
MySQL rejects database names that end in a space.
* fix(wallet-toolbox): order paged StorageKnex queries by key
Postgres does not keep row order across LIMIT/OFFSET queries without an
ORDER BY. Against a restored production wallet database, getSyncChunk for a
large user returned duplicate provenTxReqs and outputTagMaps and skipped
others. Paged find queries and the get*ForUser sync queries now order by the
table key; getCount clears the order before counting.
* docs(wallet-toolbox): explain identifier bindings in raw Postgres SQL
* chore(wallet-toolbox): drop release metadata and regenerated docs from the Postgres change
* revert(wallet-toolbox): drop MonitorDaemon and operator Postgres options
* revert(wallet-toolbox): build migration indexes as before on Postgres
Drops the CREATE INDEX CONCURRENTLY path and per-migration transaction config. Keeps bytea, the quoted activeStorage update and skipping the binary widening on Postgres.
* revert(wallet-toolbox): keep admin req review MySQL-only
* fix(wallet-toolbox): narrow StorageKnex Postgres handling
int8 parsing is private to StorageKnex; migrate uses migrate.latest; adminStats stays MySQL-only; Postgres inserts in a transaction always use a savepoint; the allocateChangeInput reservation re-check only runs on Postgres and leaves the other dialects' code unchanged.
* fix(wallet-toolbox): reject Postgres in ChaintracksStorageKnex after dialect detection
* docs(wallet-toolbox): short Postgres note; drop @types/pg
* fix(ci): clear new Sonar findings in StorageKnex Postgres support
- KnexMigrations: replace nested ternary for the bytes column type with a lookup (S3358)
- TestUtilsWalletStorage: use replaceAll for identifier quoting (S7781)
- TestUtilsWalletStorage: advance sequences concurrently instead of awaiting in a loop (S9382)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Deggen <d.kellenschwiler@bsvassociation.org>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 4d0ea63 commit 226e82e
61 files changed
Lines changed: 1172 additions & 303 deletions
File tree
- .github/workflows
- infra/wallet-infra/src
- packages/wallet/wallet-toolbox
- src
- services/chaintracker/chaintracks/Storage
- storage
- __test
- methods
- remoting
- __test
- schema
- entities/__tests
- tables
- test
- Wallet
- action
- get
- list
- storage
- utils
- wallet
- action
- construct
- list
- specs/wallet
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
969 | 969 | | |
970 | 970 | | |
971 | 971 | | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
972 | 985 | | |
973 | 986 | | |
974 | 987 | | |
| |||
989 | 1002 | | |
990 | 1003 | | |
991 | 1004 | | |
| 1005 | + | |
992 | 1006 | | |
993 | 1007 | | |
994 | 1008 | | |
995 | 1009 | | |
996 | 1010 | | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
997 | 1015 | | |
998 | 1016 | | |
999 | 1017 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
66 | 80 | | |
67 | 81 | | |
68 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
| |||
0 commit comments