From f7db6e47c3f743798b2edcb3ab1f5bb5ce789c85 Mon Sep 17 00:00:00 2001 From: Iliyan Iliev Date: Mon, 29 Jun 2020 14:45:43 +0300 Subject: [PATCH] Closes #18 --- ...PaymentManagement.MsSqlRepositories.csproj | 2 +- ...0200428180706_InitialMigration.Designer.cs | 71 ----------------- ..._AddExternalIdToPaymentReqeust.Designer.cs | 74 ------------------ ...521080903_AddExternalIdToPaymentReqeust.cs | 24 ------ ...521110045_AddIndexByExternalId.Designer.cs | 78 ------------------- .../20200521110045_AddIndexByExternalId.cs | 44 ----------- ...26144707_MakeIndexByExternalIdNonUnique.cs | 37 --------- ....cs => 20200629113000_Initial.Designer.cs} | 32 ++++---- ...Migration.cs => 20200629113000_Initial.cs} | 11 ++- .../PaymentManagementContextModelSnapshot.cs | 28 +++---- .../PaymentManagementContext.cs | 6 +- .../Repositories/PaymentRequestsRepository.cs | 2 +- .../MAVN.Service.PaymentManagement.csproj | 3 + .../Modules/DbModule.cs | 6 +- .../Settings/DbSettings.cs | 1 - 15 files changed, 50 insertions(+), 369 deletions(-) delete mode 100644 src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200428180706_InitialMigration.Designer.cs delete mode 100644 src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521080903_AddExternalIdToPaymentReqeust.Designer.cs delete mode 100644 src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521080903_AddExternalIdToPaymentReqeust.cs delete mode 100644 src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521110045_AddIndexByExternalId.Designer.cs delete mode 100644 src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521110045_AddIndexByExternalId.cs delete mode 100644 src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200526144707_MakeIndexByExternalIdNonUnique.cs rename src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/{20200526144707_MakeIndexByExternalIdNonUnique.Designer.cs => 20200629113000_Initial.Designer.cs} (67%) rename src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/{20200428180706_InitialMigration.cs => 20200629113000_Initial.cs} (84%) diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/MAVN.Service.PaymentManagement.MsSqlRepositories.csproj b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/MAVN.Service.PaymentManagement.MsSqlRepositories.csproj index f1ee5f4..19d29a5 100644 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/MAVN.Service.PaymentManagement.MsSqlRepositories.csproj +++ b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/MAVN.Service.PaymentManagement.MsSqlRepositories.csproj @@ -7,7 +7,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200428180706_InitialMigration.Designer.cs b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200428180706_InitialMigration.Designer.cs deleted file mode 100644 index 2fe82d1..0000000 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200428180706_InitialMigration.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -using System; -using MAVN.Service.PaymentManagement.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.PaymentManagement.MsSqlRepositories.Migrations -{ - [DbContext(typeof(PaymentManagementContext))] - [Migration("20200428180706_InitialMigration")] - partial class InitialMigration - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("payment") - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.PaymentManagement.MsSqlRepositories.Entities.PaymentRequestEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CustomerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("PartnerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PaymentId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PaymentStatus") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("Currency"); - - b.HasIndex("CustomerId"); - - b.HasIndex("PartnerId"); - - b.ToTable("payment_requests"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521080903_AddExternalIdToPaymentReqeust.Designer.cs b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521080903_AddExternalIdToPaymentReqeust.Designer.cs deleted file mode 100644 index 4f919f3..0000000 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521080903_AddExternalIdToPaymentReqeust.Designer.cs +++ /dev/null @@ -1,74 +0,0 @@ -// -using System; -using MAVN.Service.PaymentManagement.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.PaymentManagement.MsSqlRepositories.Migrations -{ - [DbContext(typeof(PaymentManagementContext))] - [Migration("20200521080903_AddExternalIdToPaymentReqeust")] - partial class AddExternalIdToPaymentReqeust - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("payment") - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.PaymentManagement.MsSqlRepositories.Entities.PaymentRequestEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CustomerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ExternalPaymentEntityId") - .HasColumnType("nvarchar(max)"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("PartnerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PaymentId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PaymentStatus") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("Currency"); - - b.HasIndex("CustomerId"); - - b.HasIndex("PartnerId"); - - b.ToTable("payment_requests"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521080903_AddExternalIdToPaymentReqeust.cs b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521080903_AddExternalIdToPaymentReqeust.cs deleted file mode 100644 index 7653759..0000000 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521080903_AddExternalIdToPaymentReqeust.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.PaymentManagement.MsSqlRepositories.Migrations -{ - public partial class AddExternalIdToPaymentReqeust : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ExternalPaymentEntityId", - schema: "payment", - table: "payment_requests", - nullable: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ExternalPaymentEntityId", - schema: "payment", - table: "payment_requests"); - } - } -} diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521110045_AddIndexByExternalId.Designer.cs b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521110045_AddIndexByExternalId.Designer.cs deleted file mode 100644 index 97498aa..0000000 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521110045_AddIndexByExternalId.Designer.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -using System; -using MAVN.Service.PaymentManagement.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.PaymentManagement.MsSqlRepositories.Migrations -{ - [DbContext(typeof(PaymentManagementContext))] - [Migration("20200521110045_AddIndexByExternalId")] - partial class AddIndexByExternalId - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("payment") - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.PaymentManagement.MsSqlRepositories.Entities.PaymentRequestEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("CustomerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ExternalPaymentEntityId") - .HasColumnType("nvarchar(450)"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("PartnerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PaymentId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PaymentStatus") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("Currency"); - - b.HasIndex("CustomerId"); - - b.HasIndex("ExternalPaymentEntityId") - .IsUnique() - .HasFilter("[ExternalPaymentEntityId] IS NOT NULL"); - - b.HasIndex("PartnerId"); - - b.ToTable("payment_requests"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521110045_AddIndexByExternalId.cs b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521110045_AddIndexByExternalId.cs deleted file mode 100644 index 430844c..0000000 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200521110045_AddIndexByExternalId.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.PaymentManagement.MsSqlRepositories.Migrations -{ - public partial class AddIndexByExternalId : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ExternalPaymentEntityId", - schema: "payment", - table: "payment_requests", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.CreateIndex( - name: "IX_payment_requests_ExternalPaymentEntityId", - schema: "payment", - table: "payment_requests", - column: "ExternalPaymentEntityId", - unique: true, - filter: "[ExternalPaymentEntityId] IS NOT NULL"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_payment_requests_ExternalPaymentEntityId", - schema: "payment", - table: "payment_requests"); - - migrationBuilder.AlterColumn( - name: "ExternalPaymentEntityId", - schema: "payment", - table: "payment_requests", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldNullable: true); - } - } -} diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200526144707_MakeIndexByExternalIdNonUnique.cs b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200526144707_MakeIndexByExternalIdNonUnique.cs deleted file mode 100644 index 30e73a7..0000000 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200526144707_MakeIndexByExternalIdNonUnique.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.PaymentManagement.MsSqlRepositories.Migrations -{ - public partial class MakeIndexByExternalIdNonUnique : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_payment_requests_ExternalPaymentEntityId", - schema: "payment", - table: "payment_requests"); - - migrationBuilder.CreateIndex( - name: "IX_payment_requests_ExternalPaymentEntityId", - schema: "payment", - table: "payment_requests", - column: "ExternalPaymentEntityId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_payment_requests_ExternalPaymentEntityId", - schema: "payment", - table: "payment_requests"); - - migrationBuilder.CreateIndex( - name: "IX_payment_requests_ExternalPaymentEntityId", - schema: "payment", - table: "payment_requests", - column: "ExternalPaymentEntityId", - unique: true, - filter: "[ExternalPaymentEntityId] IS NOT NULL"); - } - } -} diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200526144707_MakeIndexByExternalIdNonUnique.Designer.cs b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200629113000_Initial.Designer.cs similarity index 67% rename from src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200526144707_MakeIndexByExternalIdNonUnique.Designer.cs rename to src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200629113000_Initial.Designer.cs index 4b555eb..fa94fe9 100644 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200526144707_MakeIndexByExternalIdNonUnique.Designer.cs +++ b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200629113000_Initial.Designer.cs @@ -3,60 +3,60 @@ using MAVN.Service.PaymentManagement.MsSqlRepositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace MAVN.Service.PaymentManagement.MsSqlRepositories.Migrations { [DbContext(typeof(PaymentManagementContext))] - [Migration("20200526144707_MakeIndexByExternalIdNonUnique")] - partial class MakeIndexByExternalIdNonUnique + [Migration("20200629113000_Initial")] + partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("payment") - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); modelBuilder.Entity("MAVN.Service.PaymentManagement.MsSqlRepositories.Entities.PaymentRequestEntity", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("Amount") - .HasColumnType("decimal(18,2)"); + .HasColumnType("numeric"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("Currency") .IsRequired() - .HasColumnType("nvarchar(450)"); + .HasColumnType("text"); b.Property("CustomerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("ExternalPaymentEntityId") - .HasColumnType("nvarchar(450)"); + .HasColumnType("text"); b.Property("ModifiedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("PartnerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("PaymentId") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("PaymentStatus") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.HasKey("Id"); diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200428180706_InitialMigration.cs b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200629113000_Initial.cs similarity index 84% rename from src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200428180706_InitialMigration.cs rename to src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200629113000_Initial.cs index 11ea2f9..5624d6a 100644 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200428180706_InitialMigration.cs +++ b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/20200629113000_Initial.cs @@ -3,7 +3,7 @@ namespace MAVN.Service.PaymentManagement.MsSqlRepositories.Migrations { - public partial class InitialMigration : Migration + public partial class Initial : Migration { protected override void Up(MigrationBuilder migrationBuilder) { @@ -23,7 +23,8 @@ protected override void Up(MigrationBuilder migrationBuilder) Currency = table.Column(nullable: false), PaymentStatus = table.Column(nullable: false), CreatedAt = table.Column(nullable: false), - ModifiedAt = table.Column(nullable: false) + ModifiedAt = table.Column(nullable: false), + ExternalPaymentEntityId = table.Column(nullable: true) }, constraints: table => { @@ -42,6 +43,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "payment_requests", column: "CustomerId"); + migrationBuilder.CreateIndex( + name: "IX_payment_requests_ExternalPaymentEntityId", + schema: "payment", + table: "payment_requests", + column: "ExternalPaymentEntityId"); + migrationBuilder.CreateIndex( name: "IX_payment_requests_PartnerId", schema: "payment", diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/PaymentManagementContextModelSnapshot.cs b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/PaymentManagementContextModelSnapshot.cs index 3dbbd0c..e0e5507 100644 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/PaymentManagementContextModelSnapshot.cs +++ b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Migrations/PaymentManagementContextModelSnapshot.cs @@ -3,8 +3,8 @@ using MAVN.Service.PaymentManagement.MsSqlRepositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace MAVN.Service.PaymentManagement.MsSqlRepositories.Migrations { @@ -16,45 +16,45 @@ protected override void BuildModel(ModelBuilder modelBuilder) #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("payment") - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); modelBuilder.Entity("MAVN.Service.PaymentManagement.MsSqlRepositories.Entities.PaymentRequestEntity", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("Amount") - .HasColumnType("decimal(18,2)"); + .HasColumnType("numeric"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("Currency") .IsRequired() - .HasColumnType("nvarchar(450)"); + .HasColumnType("text"); b.Property("CustomerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("ExternalPaymentEntityId") - .HasColumnType("nvarchar(450)"); + .HasColumnType("text"); b.Property("ModifiedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("PartnerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("PaymentId") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("PaymentStatus") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.HasKey("Id"); diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/PaymentManagementContext.cs b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/PaymentManagementContext.cs index f6ee330..533ec55 100644 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/PaymentManagementContext.cs +++ b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/PaymentManagementContext.cs @@ -1,6 +1,6 @@ using System.Data.Common; using JetBrains.Annotations; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.PaymentManagement.Domain.Enums; using MAVN.Service.PaymentManagement.MsSqlRepositories.Entities; using Microsoft.AspNetCore.JsonPatch.Operations; @@ -9,7 +9,7 @@ namespace MAVN.Service.PaymentManagement.MsSqlRepositories { - public class PaymentManagementContext : MsSqlContext + public class PaymentManagementContext : PostgreSQLContext { private const string Schema = "payment"; @@ -38,7 +38,7 @@ public PaymentManagementContext(DbConnection dbConnection) { } - protected override void OnLykkeModelCreating(ModelBuilder modelBuilder) + protected override void OnMAVNModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .HasIndex(p => p.CustomerId); diff --git a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Repositories/PaymentRequestsRepository.cs b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Repositories/PaymentRequestsRepository.cs index 3b384f6..18b84a6 100644 --- a/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Repositories/PaymentRequestsRepository.cs +++ b/src/MAVN.Service.PaymentManagement.MsSqlRepositories/Repositories/PaymentRequestsRepository.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Threading.Tasks; using AutoMapper; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.PaymentManagement.Domain; using MAVN.Service.PaymentManagement.Domain.Enums; using MAVN.Service.PaymentManagement.Domain.Repositories; diff --git a/src/MAVN.Service.PaymentManagement/MAVN.Service.PaymentManagement.csproj b/src/MAVN.Service.PaymentManagement/MAVN.Service.PaymentManagement.csproj index b57b875..53b9f0b 100644 --- a/src/MAVN.Service.PaymentManagement/MAVN.Service.PaymentManagement.csproj +++ b/src/MAVN.Service.PaymentManagement/MAVN.Service.PaymentManagement.csproj @@ -17,6 +17,9 @@ + + Always + PreserveNewest diff --git a/src/MAVN.Service.PaymentManagement/Modules/DbModule.cs b/src/MAVN.Service.PaymentManagement/Modules/DbModule.cs index ff4abc6..1709634 100644 --- a/src/MAVN.Service.PaymentManagement/Modules/DbModule.cs +++ b/src/MAVN.Service.PaymentManagement/Modules/DbModule.cs @@ -1,7 +1,7 @@ -using Autofac; +using Autofac; using JetBrains.Annotations; -using MAVN.Common.MsSql; using Lykke.SettingsReader; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.PaymentManagement.Domain.Repositories; using MAVN.Service.PaymentManagement.MsSqlRepositories; using MAVN.Service.PaymentManagement.MsSqlRepositories.Repositories; @@ -25,7 +25,7 @@ protected override void Load(ContainerBuilder builder) .As() .SingleInstance(); - builder.RegisterMsSql( + builder.RegisterPostgreSQL( _connectionString, connString => new PaymentManagementContext(connString, false), dbConn => new PaymentManagementContext(dbConn)); diff --git a/src/MAVN.Service.PaymentManagement/Settings/DbSettings.cs b/src/MAVN.Service.PaymentManagement/Settings/DbSettings.cs index 5ca0b14..baeb2e4 100644 --- a/src/MAVN.Service.PaymentManagement/Settings/DbSettings.cs +++ b/src/MAVN.Service.PaymentManagement/Settings/DbSettings.cs @@ -7,7 +7,6 @@ public class DbSettings [AzureTableCheck] public string LogsConnString { get; set; } - [SqlCheck] public string SqlDbConnString { get; set; } } }