You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SqlMessageStorage: export an encoded storage constructor that skips migrations #9321
Follow-up to #8894. effect 4.0.5 lets the runtime use SQL cluster storage without running DDL: SqlMessageStorage.layerMigrations runs the migrations in a deploy step, and SqlMessageStorage.layerStorage builds a MessageStorage without them.
There is no equivalent for the encoded driver. SqlMessageStorage.makeEncoded always runs the migrations first:
makeEncodedStorage isn't exported. So a custom adapter has to call makeEncoded, and with it the migrator, at runtime. A custom adapter here means one that wraps the SQL driver's MessageStorage.Encoded and then calls MessageStorage.makeEncoded, for example to run extra bookkeeping in the same transaction as saveEnvelope/saveReply. Such an adapter can't use layerStorage, because that returns an already-decoded MessageStorage.
Even when layerMigrations has already applied everything, the migrator still runs at every startup: it ensures the history table exists and takes LOCK TABLE cluster_migrations IN ACCESS EXCLUSIVE MODE. That means the runtime role needs privileges on the history table, and the "migrate in a deploy step" setup from #8894 doesn't fully work for custom adapters.
What is the feature you are proposing to solve the problem?
Export an encoded constructor that skips migrations, matching layerStorage. For example:
export makeEncodedStorage (or makeEncodedWithoutMigrations); or
Deep-importing the unexported constructor: this depends on private module paths.
Keeping makeEncoded and letting the migrator no-op: this works, but still takes the exclusive lock on the history table and needs DDL-adjacent privileges at runtime.
Activity