EnvelopeFlow.Stores.Migrations.Postgres 0.1.0-alpha.3.1

This is a prerelease version of EnvelopeFlow.Stores.Migrations.Postgres.
dotnet add package EnvelopeFlow.Stores.Migrations.Postgres --version 0.1.0-alpha.3.1
                    
NuGet\Install-Package EnvelopeFlow.Stores.Migrations.Postgres -Version 0.1.0-alpha.3.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EnvelopeFlow.Stores.Migrations.Postgres" Version="0.1.0-alpha.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EnvelopeFlow.Stores.Migrations.Postgres" Version="0.1.0-alpha.3.1" />
                    
Directory.Packages.props
<PackageReference Include="EnvelopeFlow.Stores.Migrations.Postgres" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EnvelopeFlow.Stores.Migrations.Postgres --version 0.1.0-alpha.3.1
                    
#r "nuget: EnvelopeFlow.Stores.Migrations.Postgres, 0.1.0-alpha.3.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EnvelopeFlow.Stores.Migrations.Postgres@0.1.0-alpha.3.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EnvelopeFlow.Stores.Migrations.Postgres&version=0.1.0-alpha.3.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=EnvelopeFlow.Stores.Migrations.Postgres&version=0.1.0-alpha.3.1&prerelease
                    
Install as a Cake Tool

Explicit PostgreSQL migration protocol

PostgresMigrationRunner uses an application-owned NpgsqlDataSource and a feature-owned PostgresMigrationCatalog. Construction never connects. InspectAsync and PlanAsync use a read-only transaction and do not create the migration journal. An operator explicitly calls ApplyAsync, AdoptBaselineAsync or a feature initializer; dependency injection and workers never migrate automatically.

The catalog contains an immutable contiguous sequence beginning with version one's fresh schema SQL. Migration identities and exact SQL bytes contribute to a SHA-256 checksum. Every applied journal row must match the supplied history. Unknown future versions, missing versions, modified checksums and downgrades fail explicitly. Never edit an applied migration; append a supported step. SQL and baseline queries are trusted deployment code supplied by each feature, not untrusted request input. This package supplies no universal data converter or application user schema.

ApplyAsync rechecks the journal under a transaction advisory lock, executes pending steps and records them in one transaction. A failed/cancelled SQL step rolls back its DDL/data and the journal; an operator can correct an unapplied step and retry. A lost commit acknowledgement requires inspection/repeated application, which verifies the same checksums and performs no duplicate applied step. The lock serializes protocol migrations within the selected schema, including journal creation across components; an unrelated schema can migrate independently. Default lock wait is five seconds; the entire operation is bounded to thirty seconds. Configure positive limits of at most five minutes. Transaction-incompatible DDL, such as concurrent index creation, is deliberately unsupported in this protocol.

Each operation captures PostgreSQL's current_schema() once and explicitly qualifies its journal in that schema. A later schema in search_path cannot supply another schema's history. A search path with no current schema fails explicitly. Applications own search_path and must select the intended migration namespace before invoking the runner. Trusted migration and baseline SQL retain their normal PostgreSQL name-resolution behavior; changing the search path inside migration SQL does not move the captured journal. See PostgreSQL 18's schema search path and advisory locks.

Fresh ApplyAsync and baseline adoption are distinct. To adopt a schema created by an existing explicit initializer, the responsible feature supplies a supported-version PostgresSchemaBaseline with a read-only query returning exactly Boolean true after checking its required schema/format. Adoption executes that query and records prior versions as adopted; it does not execute historical migration SQL or rewrite operational records. Keep deployment writers paused while adopting/upgrading an existing unversioned schema, since older initializers do not acquire this protocol lock. A repeated matching adoption is harmless; adopting over a different versioned history is rejected. Inspecting a journal does not by itself certify that external code has never altered the schema.

Features own compatibility fixtures and payload converters. Operators must back up operational data, inspect the plan, stop incompatible readers/writers, apply/adopt explicitly and only then enable new readers/writers. A schema downgrade is not available; restore a verified backup if an irreversible feature conversion needs recovery. Preserve original scope, identifiers, revisions, fences, idempotency fingerprints and outbox IDs during feature migrations. Do not print migration SQL, connection strings, raw database exception details or stored payloads in operational telemetry.

InitializeAsync(legacyTable) combines explicit initialization and known-schema adoption. Under the same lock/transaction it validates history, detects the feature's representative table, validates the highest matching declared legacy baseline when no history exists, then records adoption and applies pending versions. Invalid legacy shapes and failed upgrades leave no partial adoption. This operation is used by the bounded-key delivery, inbound, campaign and conversation initializers; it never runs merely because a store is constructed.

PostgresBoundedKeys.Version1Sql is frozen migration SQL for schema-local, JSON-framed UTF-8 SHA256 keys. Features own their generated columns and constraints; exact raw identity checks remain with their stores. See bounded-key deployment for the maintenance window and incompatible-binary rollout requirements.

Focused local tests use ENVELOPEFLOW_TEST_POSTGRES against a disposable PostgreSQL fixture. They exercise a synthetic feature schema and real transactional concurrency/failure; this protocol alone does not certify every existing store's baseline or mixed-version payload window.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (14)

Showing the top 5 NuGet packages that depend on EnvelopeFlow.Stores.Migrations.Postgres:

Package Downloads
EnvelopeFlow.Stores.Postgres

Explicitly initialized PostgreSQL delivery and device persistence with fenced updates.

EnvelopeFlow.Inbound.Stores.Postgres

Durable PostgreSQL inbound receipt acceptance and fenced dispatch.

EnvelopeFlow.Inbox.Stores.Postgres

Optional durable PostgreSQL inbox entries, dedup tombstones and atomic change outbox.

EnvelopeFlow.Preferences.Stores.Postgres

Durable PostgreSQL consent, frequency reservations and suppression-token consumption.

EnvelopeFlow.Experiments.Stores.Postgres

Explicitly migrated PostgreSQL experiment assignments and exposure persistence.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha.3.1 78 11/22/2026
0.1.0-alpha.2.1 136 11/9/2026