Itmo.Dev.Platform.Postgres 1.1.101

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Itmo.Dev.Platform.Postgres --version 1.1.101
NuGet\Install-Package Itmo.Dev.Platform.Postgres -Version 1.1.101
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="Itmo.Dev.Platform.Postgres" Version="1.1.101" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Itmo.Dev.Platform.Postgres --version 1.1.101
#r "nuget: Itmo.Dev.Platform.Postgres, 1.1.101"
#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.
// Install Itmo.Dev.Platform.Postgres as a Cake Addin
#addin nuget:?package=Itmo.Dev.Platform.Postgres&version=1.1.101

// Install Itmo.Dev.Platform.Postgres as a Cake Tool
#tool nuget:?package=Itmo.Dev.Platform.Postgres&version=1.1.101

Itmo.Dev.Platform.Postgres

Platform extensions for working with PostgreSQL database

Connection

You can obtain database connection using IPostgresConnectionProvider

var connection = await provider.GetConnectionAsync(cancellationToken);

Migrations

Package using FluentMigrator as it's migration engine, thus all FluentMigrator's migrations are compatible and will be executed.

Nevertheless, it is strongly recommended to inherit from SqlMigration and implement your migrations as raw sql queries.

[Migration(1, "Initial")]
public class InitialMigration : SqlMigration
{
    protected override string GetUpSql(IServiceProvider serviceProvider)
    {
        return """
        CREATE TABLE USERS
        (
            user_id bigint PRIMARY KEY,
            user_name text NOT NULL
        );
        """;
    }
    
    protected override string GetDownSql(IServiceProvider serviceProvider)
    {
        return """
        DROP TABLE USERS;
        """;
    }
}

Registration

Use extension methods on service collection to register Itmo.Dev.Platform.Postgres services and migrations.

Connection

To configure connection string bind configuration with such schema to configuration builder, using extension method's parameter.

{
  "Host" : "string",
  "Port" : 5432,
  "Database" : "string",
  "Username" : "string",
  "Password" : "string",
  "SslMode" : "string",
  "Pooling" : true
}
collection.AddPlatformPostgres(options => options.Bind("Database"));

Migrations

To register migrations call AddPlatformMigrations on service collection. Pass the assemblies containing migration classes.

collection.AddPlatformMigrations(typeof(IMigrationsAssemblyMarker).Assembly);

To run migrations, create scope and call UsePlatformMigrationsAsync on it.

using var scope = serviceProvider.CreateScope();
await scope.UsePlatformMigrationsAsync()
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Itmo.Dev.Platform.Postgres:

Package Downloads
Itmo.Dev.Platform.Testing The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Package Description

Itmo.Dev.Platform.BackgroundTasks The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Package Description

Itmo.Dev.Platform.MessagePersistence The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.101 45 4/26/2024
1.1.100 98 4/22/2024
1.1.99 94 4/21/2024
1.1.98 97 4/21/2024
1.1.97 92 4/19/2024
1.1.96 86 4/18/2024
1.1.95 93 4/18/2024
1.1.94 191 2/13/2024
1.1.93 139 2/10/2024
1.1.91 107 2/10/2024
1.1.90 108 2/10/2024
1.1.89 421 2/3/2024
1.1.86 126 2/1/2024
1.1.85 102 1/30/2024
1.1.83 213 1/27/2024
1.1.82 371 1/5/2024
1.1.81 237 1/3/2024
1.1.80 128 12/30/2023
1.1.79 105 12/30/2023
1.1.78 113 12/30/2023
1.1.77 141 12/28/2023
1.1.76 124 12/27/2023
1.1.75 746 12/9/2023
1.1.73 261 11/30/2023
1.1.72 193 11/27/2023
1.1.71 139 11/27/2023
1.1.70 140 11/27/2023
1.1.69 127 11/27/2023
1.1.67 140 11/25/2023
1.1.66 129 11/25/2023
1.1.65 152 11/23/2023
1.1.64 135 11/23/2023
1.1.62 523 11/18/2023
1.1.61 127 11/18/2023
1.1.60 131 11/17/2023
1.1.59 126 11/16/2023
1.0.58 131 11/13/2023
1.0.57 119 11/12/2023
1.0.56 125 11/12/2023
1.0.54 119 11/7/2023
1.0.53 140 11/4/2023
1.0.52 147 10/29/2023
1.0.51 128 10/29/2023
1.0.50 146 10/29/2023
1.0.48 264 10/29/2023

Added connection creation logging