Conversation
Add 'Postgres' to DBType, TableSettings.dbtype and the remote settings validator. Postgres dates use Date objects, as on MySQL.
- 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.
- 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.
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.
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.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…gres # Conflicts: # docs/reference/package-api-migrations.md # docs/reference/stack-facts.md # governance/package-release-notes.json # governance/repository-health/baselines.json
The MySQL driver writes Dates in the client time zone, so a client and server in different zones shifted hoursOld by the offset.
…e names MySQL rejects database names that end in a space.
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.
…m the Postgres change
Drops the CREATE INDEX CONCURRENTLY path and per-migration transaction config. Keeps bytea, the quoted activeStorage update and skipping the binary widening on Postgres.
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.
…dialect detection
shruggr
marked this pull request as ready for review
October 1, 2026 20:21
shruggr
requested review from
BraydenLangley,
sirdeggen,
tonesnotes and
ty-everett
as code owners
October 1, 2026 20:21
shruggr
added a commit
to b-open-io/1sat-sdk
that referenced
this pull request
Oct 1, 2026
…ignatures - wallet-node: StorageKnexPg (toolbox StorageKnex on a pg knex) replaces StoragePg. Existing databases need scripts/migrations/2026-10-01-storagepg-to-storageknex.sql first. - wallet-server: createStorageServer runs the toolbox StorageServer standalone; RedisSessionManager is an AsyncSessionManager; the host no longer serves storage RPC; the accounts capacity gate and the hand-written RPC server are removed. - cli: `1sat serve storage` replaces `1sat serve wallet`. - wallet, cli: StorageClient sends binary request bodies. - templates, actions: createSignature gets only hashToDirectlySign (@bsv/sdk 2.8.11 rejects data plus hashToDirectlySign). - @bsv/wallet-toolbox(-client) resolve to @bopen-io 2.14.5 (upstream 2.14.4 + bsv-blockchain/ts-stack#719). - paymail: default avatar route; public profile no longer 500s on an empty avatar.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Lets
StorageKnexrun on Postgres through the knexpgclient. Dialect fixes only; SQLite and MySQL behavior is unchanged except where noted.Changes
'Postgres'added toDBType,TableSettings.dbtype, theStorageClientBasesettings check andspecs/wallet/storage-adapter.yaml.determineDBTypereturns'Postgres'for the pg dialect.byteainstead ofblob, nobinary(len)widening on Postgres, quotedactiveStoragein the raw update.??identifier bindings so camelCase columns are quoted (Postgres lowercases unquoted names). Boolean columns are compared withtrue/falseinstead of1/0.RETURNINGon Postgres to get the new id. Inside a transaction the insert runs in a savepoint, so a duplicate key caught by the find-or-insert helpers does not abort the caller's transaction.getCountaliases the count and converts it withNumber().satoshis,count(*)) as strings.StorageKnexsets an int8 parser on each connection its knex acquires. The process-widepg.typesdefaults are not changed.allocateChangeInput: under Postgres READ COMMITTED, theNOT EXISTSreservation check does not see an action batch reservation committed while the statement waited for the row lock. On Postgres only, the picked output is re-checked and the allocation is retried in a new transaction if it was reserved.FOR UPDATEon the prepared BEEF epoch and sync state reads now applies to Postgres as well as MySQL.KnexSessionManagermerges boolean flags without integer comparisons.KnexSessionManagerandKnexPaymentReplayStore(and theinfra/wallet-infracopy) treat23505as a duplicate key.ORDER BYthe table key. Without it, consecutiveLIMIT/OFFSETpages can return rows in different orders (on Postgres this happens in practice), so sync chunks could repeat or skip rows.ChaintracksStorageKnexandadminStats(and the admin req review) still do not support Postgres.Tests
RUNPOSTGRES=1withPOSTGRES_CONNECTION(JSON node-postgres config) adds a Postgres store to the existing Knex suites. CI runs the sharded toolbox jobs with a Postgres 17 service.allocateChangeInputreservation race and the remoting stores.Local results (Postgres 17):
lint,typecheck,format:check,health:checkpass.