Pure.RelationalSchema.Storage.PostgreSQL
0.1.0-preview.10.1.0
dotnet add package Pure.RelationalSchema.Storage.PostgreSQL --version 0.1.0-preview.10.1.0
NuGet\Install-Package Pure.RelationalSchema.Storage.PostgreSQL -Version 0.1.0-preview.10.1.0
<PackageReference Include="Pure.RelationalSchema.Storage.PostgreSQL" Version="0.1.0-preview.10.1.0" />
<PackageVersion Include="Pure.RelationalSchema.Storage.PostgreSQL" Version="0.1.0-preview.10.1.0" />
<PackageReference Include="Pure.RelationalSchema.Storage.PostgreSQL" />
paket add Pure.RelationalSchema.Storage.PostgreSQL --version 0.1.0-preview.10.1.0
#r "nuget: Pure.RelationalSchema.Storage.PostgreSQL, 0.1.0-preview.10.1.0"
#:package Pure.RelationalSchema.Storage.PostgreSQL@0.1.0-preview.10.1.0
#addin nuget:?package=Pure.RelationalSchema.Storage.PostgreSQL&version=0.1.0-preview.10.1.0&prerelease
#tool nuget:?package=Pure.RelationalSchema.Storage.PostgreSQL&version=0.1.0-preview.10.1.0&prerelease
Pure.RelationalSchema.Storage.PostgreSQL
PostgreSQL storage for the Pure relational schema ecosystem. This package has been split into separate packages; Pure.RelationalSchema.Storage.PostgreSQL is now a meta-package that contains no code and references all of them, and this repository aggregates their sources as submodules.
Packages
| Package | Repository | Contents |
|---|---|---|
Pure.RelationalSchema.Storage.PostgreSQL.Abstractions |
source | IPostgreSqlStoredSchemaDataSet |
Pure.RelationalSchema.Storage.PostgreSQL.Creation |
source | PostgreSqlCreatedSchema (DDL) |
Pure.RelationalSchema.Storage.PostgreSQL.Querying |
source | PostgreSqlStoredSchemaDataSet, PostgreSqlStoredTableDataSet |
Pure.RelationalSchema.Storage.PostgreSQL.Insertion |
source | PostgreSqlStoredSchemaDataSetWithInsertedRows |
Pure.RelationalSchema.Storage.PostgreSQL.Migration |
source | PostgreSqlMigratedSchema, SchemaMigration, TableMapping, ColumnMapping |
Pure.RelationalSchema.Storage.PostgreSQL.Destruction |
source | PostgreSqlDroppedSchema |
Pure.RelationalSchema.Storage.PostgreSQL.Existence |
source | PostgreSqlStoredSchemaExistence |
Installing Pure.RelationalSchema.Storage.PostgreSQL pulls in all seven. To take only what you need, reference the individual packages instead.
- Insertion and Querying depend on Abstractions; they do not depend on each other or on Creation.
- Migration depends on Creation (
0.1.0-preview.0.4.0or later), which creates what is new in the target schema, and onPure.RelationalSchema.Migration.Abstractions(ISchemaMigration,ITableMapping,IColumnMapping). - Destruction depends on none of the other packages. It finds the storage by the same schema hash that Creation uses.
- Existence depends on none of the other packages either. It looks up the storage by the same schema hash.
Migrating from 0.1.0-preview.8.x
The last release that contained code is 0.1.0-preview.8.1.2. Every public type moved to a new namespace, so after updating the package reference you must change your using directives:
| Old type | New namespace |
|---|---|
IPostgreSqlStoredSchemaDataSet |
Pure.RelationalSchema.Storage.PostgreSQL.Abstractions |
PostgreSqlCreatedSchema |
Pure.RelationalSchema.Storage.PostgreSQL.Creation |
PostgreSqlStoredSchemaDataSet, PostgreSqlStoredTableDataSet |
Pure.RelationalSchema.Storage.PostgreSQL.Querying |
PostgreSqlStoredSchemaDataSetWithInsertedRows |
Pure.RelationalSchema.Storage.PostgreSQL.Insertion |
Replace using Pure.RelationalSchema.Storage.PostgreSQL; with the namespaces above.
Behaviour change: asynchronous enumeration in Querying (await foreach over a PostgreSqlStoredTableDataSet) no longer disposes the IDbConnection you passed in. Previously the connection was closed after the first async enumeration; you now own its lifetime.
Usage
using System.Data;
using Pure.RelationalSchema.Abstractions.Schema;
using Pure.RelationalSchema.Abstractions.Table;
using Pure.RelationalSchema.Storage.Abstractions;
using Pure.RelationalSchema.Storage.PostgreSQL.Abstractions;
using Pure.RelationalSchema.Storage.PostgreSQL.Creation;
using Pure.RelationalSchema.Storage.PostgreSQL.Insertion;
using Pure.RelationalSchema.Storage.PostgreSQL.Querying;
// schema is your ISchema; connection is an open IDbConnection
ISchema createdSchema = new PostgreSqlCreatedSchema(schema, connection);
IPostgreSqlStoredSchemaDataSet dataset =
new PostgreSqlStoredSchemaDataSet(createdSchema, connection);
IStoredTableDataSet tableDataset = dataset[myTable];
await foreach (IRow row in tableDataset)
{
// ...
}
// rowGroups: IEnumerable<IGrouping<ITable, IRow>>
IPostgreSqlStoredSchemaDataSet withInserted =
new PostgreSqlStoredSchemaDataSetWithInsertedRows(dataset, rowGroups);
Migrating stored data to a changed schema, and dropping a schema's storage:
using Pure.RelationalSchema.Abstractions.Schema;
using Pure.RelationalSchema.Migration.Abstractions.TableMapping;
using Pure.RelationalSchema.Storage.PostgreSQL.Destruction;
using Pure.RelationalSchema.Storage.PostgreSQL.Migration;
using IDbConnection = System.Data.IDbConnection;
// source is the stored ISchema, target its changed version.
// tableMappings: IEnumerable<ITableMapping>, needed only for changed tables and columns.
// Reading a member drops, renames, retypes and adds what changed, then creates what is new.
ISchema migratedSchema =
new PostgreSqlMigratedSchema(source, target, tableMappings, connection);
_ = migratedSchema.Name;
// Drops the schema's storage with all its tables and data, on first member access.
_ = new PostgreSqlDroppedSchema(migratedSchema, connection).Name;
System.Data also declares ITableMapping and IColumnMapping, so alias what you need from it instead of importing the whole namespace in files that use the migration types.
Checking whether a schema's storage exists, for example to migrate only stored data:
using Pure.Primitives.Abstractions.Bool;
using Pure.RelationalSchema.Storage.PostgreSQL.Existence;
using Pure.RelationalSchema.Storage.PostgreSQL.Migration;
// source, target, tableMappings and connection as above.
// Queries the PostgreSQL catalog again on every read of BoolValue.
IBool stored = new PostgreSqlStoredSchemaExistence(source, connection);
if (stored.BoolValue)
{
_ = new PostgreSqlMigratedSchema(source, target, tableMappings, connection).Name;
}
Working on the packages together
The package repositories are included as submodules under modules/, pinned to their released tags, and src/Pure.RelationalSchema.Storage.PostgreSQL.slnx opens all of them in one solution.
git clone --recurse-submodules https://github.com/kudima03/Pure.RelationalSchema.Storage.PostgreSQL
cd Pure.RelationalSchema.Storage.PostgreSQL/src
dotnet build
Changes to a package are made in its own repository and released there. Dependabot bumps the submodule pointers and the meta-package's package references. Tests run in each package's repository CI.
Target Frameworks
- .NET 8
- .NET 9
- .NET 10
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Pure.RelationalSchema.Storage.PostgreSQL.Abstractions (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Creation (>= 0.1.0-preview.0.4.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Destruction (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Existence (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Insertion (>= 0.1.0-preview.1.0.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Migration (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Querying (>= 0.1.0-preview.0.9.1)
-
net8.0
- Pure.RelationalSchema.Storage.PostgreSQL.Abstractions (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Creation (>= 0.1.0-preview.0.4.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Destruction (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Existence (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Insertion (>= 0.1.0-preview.1.0.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Migration (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Querying (>= 0.1.0-preview.0.9.1)
-
net9.0
- Pure.RelationalSchema.Storage.PostgreSQL.Abstractions (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Creation (>= 0.1.0-preview.0.4.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Destruction (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Existence (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Insertion (>= 0.1.0-preview.1.0.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Migration (>= 0.1.0-preview.0.1.0)
- Pure.RelationalSchema.Storage.PostgreSQL.Querying (>= 0.1.0-preview.0.9.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.10.1.0 | 48 | 11/5/2026 |
| 0.1.0-preview.10.0.0 | 73 | 10/31/2026 |
| 0.1.0-preview.9.2.0 | 90 | 10/26/2026 |
| 0.1.0-preview.9.1.0 | 113 | 10/23/2026 |
| 0.1.0-preview.9.0.0 | 161 | 10/16/2026 |
| 0.1.0-preview.8.1.2 | 762 | 8/6/2026 |
| 0.1.0-preview.8.1.1 | 504 | 6/25/2026 |
| 0.1.0-preview.8.1.0 | 285 | 6/8/2026 |
| 0.1.0-preview.8.0.0 | 114 | 6/7/2026 |
| 0.1.0-preview.7.0.1 | 528 | 5/7/2026 |
| 0.1.0-preview.7.0.0 | 699 | 3/14/2026 |
| 0.1.0-preview.6.1.0 | 136 | 3/11/2026 |
| 0.1.0-preview.6.0.0 | 112 | 3/11/2026 |
| 0.1.0-preview.5.2.1 | 862 | 11/19/2025 |
| 0.1.0-preview.5.2.0 | 440 | 11/19/2025 |
| 0.1.0-preview.5.1.0 | 452 | 11/18/2025 |
| 0.1.0-preview.5.0.1 | 392 | 11/17/2025 |
| 0.1.0-preview.5.0.0 | 431 | 11/4/2025 |
| 0.1.0-preview.4.0.2 | 235 | 10/28/2025 |
| 0.1.0-preview.4.0.1 | 211 | 10/24/2025 |