Itmo.Dev.Platform.Postgres
1.1.69
Prefix Reserved
See the version list below for details.
dotnet add package Itmo.Dev.Platform.Postgres --version 1.1.69
NuGet\Install-Package Itmo.Dev.Platform.Postgres -Version 1.1.69
<PackageReference Include="Itmo.Dev.Platform.Postgres" Version="1.1.69" />
paket add Itmo.Dev.Platform.Postgres --version 1.1.69
#r "nuget: Itmo.Dev.Platform.Postgres, 1.1.69"
// Install Itmo.Dev.Platform.Postgres as a Cake Addin #addin nuget:?package=Itmo.Dev.Platform.Postgres&version=1.1.69 // Install Itmo.Dev.Platform.Postgres as a Cake Tool #tool nuget:?package=Itmo.Dev.Platform.Postgres&version=1.1.69
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.0
- FluentMigrator (>= 3.3.2)
- FluentMigrator.Runner (>= 3.3.2)
- FluentMigrator.Runner.Postgres (>= 3.3.2)
- Itmo.Dev.Platform.Common (>= 1.1.69)
- Microsoft.Extensions.Options (>= 7.0.1)
- Newtonsoft.Json (>= 13.0.3)
- Npgsql (>= 7.0.4)
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 | |
---|---|---|---|
1.1.174 | 77 | 10/25/2024 | |
1.1.105 | 276 | 5/4/2024 | |
1.1.102 | 161 | 5/4/2024 | |
1.1.101 | 182 | 4/26/2024 | |
1.1.100 | 187 | 4/22/2024 | |
1.1.99 | 165 | 4/21/2024 | |
1.1.98 | 167 | 4/21/2024 | |
1.1.97 | 160 | 4/19/2024 | |
1.1.96 | 158 | 4/18/2024 | |
1.1.95 | 163 | 4/18/2024 | |
1.1.94 | 270 | 2/13/2024 | |
1.1.93 | 207 | 2/10/2024 | |
1.1.91 | 168 | 2/10/2024 | |
1.1.90 | 167 | 2/10/2024 | |
1.1.89 | 602 | 2/3/2024 | |
1.1.86 | 188 | 2/1/2024 | |
1.1.85 | 214 | 1/30/2024 | |
1.1.83 | 288 | 1/27/2024 | |
1.1.82 | 452 | 1/5/2024 | |
1.1.81 | 330 | 1/3/2024 | |
1.1.80 | 185 | 12/30/2023 | |
1.1.79 | 173 | 12/30/2023 | |
1.1.78 | 178 | 12/30/2023 | |
1.1.77 | 199 | 12/28/2023 | |
1.1.76 | 191 | 12/27/2023 | |
1.1.75 | 878 | 12/9/2023 | |
1.1.73 | 337 | 11/30/2023 | |
1.1.72 | 250 | 11/27/2023 | |
1.1.71 | 203 | 11/27/2023 | |
1.1.70 | 202 | 11/27/2023 | |
1.1.69 | 182 | 11/27/2023 | |
1.1.67 | 197 | 11/25/2023 | |
1.1.66 | 188 | 11/25/2023 | |
1.1.65 | 227 | 11/23/2023 | |
1.1.64 | 200 | 11/23/2023 | |
1.1.62 | 598 | 11/18/2023 | |
1.1.61 | 186 | 11/18/2023 | |
1.1.60 | 189 | 11/17/2023 | |
1.1.59 | 183 | 11/16/2023 | |
1.0.58 | 186 | 11/13/2023 | |
1.0.57 | 180 | 11/12/2023 | |
1.0.56 | 193 | 11/12/2023 | |
1.0.54 | 228 | 11/7/2023 | |
1.0.53 | 198 | 11/4/2023 | |
1.0.52 | 207 | 10/29/2023 | |
1.0.51 | 190 | 10/29/2023 | |
1.0.50 | 201 | 10/29/2023 | |
1.0.48 | 332 | 10/29/2023 |
Added MaximumPoolSize configuration