diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 5e0121c..8c06953 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -51,7 +51,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 2.2.207
+ dotnet-version: 3.1.302
- name: Install dependencies
run: dotnet restore
- name: Build solution
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index a1681ef..1672c63 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -16,7 +16,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 2.2.207
+ dotnet-version: 3.1.302
- name: Install dependencies
run: dotnet restore
- name: Build
diff --git a/client/MAVN.Service.Vouchers.Client/MAVN.Service.Vouchers.Client.csproj b/client/MAVN.Service.Vouchers.Client/MAVN.Service.Vouchers.Client.csproj
index 7c6ebb4..bf27e3f 100644
--- a/client/MAVN.Service.Vouchers.Client/MAVN.Service.Vouchers.Client.csproj
+++ b/client/MAVN.Service.Vouchers.Client/MAVN.Service.Vouchers.Client.csproj
@@ -8,8 +8,8 @@
true
-
-
+
+
diff --git a/src/MAVN.Service.Vouchers.Domain/MAVN.Service.Vouchers.Domain.csproj b/src/MAVN.Service.Vouchers.Domain/MAVN.Service.Vouchers.Domain.csproj
index 46f9839..926891c 100644
--- a/src/MAVN.Service.Vouchers.Domain/MAVN.Service.Vouchers.Domain.csproj
+++ b/src/MAVN.Service.Vouchers.Domain/MAVN.Service.Vouchers.Domain.csproj
@@ -1,6 +1,6 @@
-
+
- netcoreapp2.2
+ netcoreapp3.1
1.0.0
diff --git a/src/MAVN.Service.Vouchers.DomainServices/MAVN.Service.Vouchers.DomainServices.csproj b/src/MAVN.Service.Vouchers.DomainServices/MAVN.Service.Vouchers.DomainServices.csproj
index 036668a..80abb31 100644
--- a/src/MAVN.Service.Vouchers.DomainServices/MAVN.Service.Vouchers.DomainServices.csproj
+++ b/src/MAVN.Service.Vouchers.DomainServices/MAVN.Service.Vouchers.DomainServices.csproj
@@ -1,19 +1,19 @@
- netcoreapp2.2
+ netcoreapp3.1
1.0.0
-
+
-
+
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/AutofacModule.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/AutofacModule.cs
index d63ae76..f5800d0 100644
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/AutofacModule.cs
+++ b/src/MAVN.Service.Vouchers.MsSqlRepositories/AutofacModule.cs
@@ -1,5 +1,5 @@
using Autofac;
-using MAVN.Common.MsSql;
+using MAVN.Persistence.PostgreSQL.Legacy;
using MAVN.Service.Vouchers.Domain.Repositories;
using MAVN.Service.Vouchers.MsSqlRepositories.Context;
@@ -16,7 +16,7 @@ public AutofacModule(string connectionString)
protected override void Load(ContainerBuilder builder)
{
- builder.RegisterMsSql(_connectionString,
+ builder.RegisterPostgreSQL(_connectionString,
connectionString => new DataContext(connectionString, false),
dbConnection => new DataContext(dbConnection));
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Context/DataContext.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Context/DataContext.cs
index c853aab..c52f5b5 100644
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Context/DataContext.cs
+++ b/src/MAVN.Service.Vouchers.MsSqlRepositories/Context/DataContext.cs
@@ -1,5 +1,5 @@
using System.Data.Common;
-using MAVN.Common.MsSql;
+using MAVN.Persistence.PostgreSQL.Legacy;
using MAVN.Service.Vouchers.Domain.Entities;
using MAVN.Service.Vouchers.MsSqlRepositories.Entities;
using Microsoft.EntityFrameworkCore;
@@ -7,7 +7,7 @@
namespace MAVN.Service.Vouchers.MsSqlRepositories.Context
{
- public class DataContext : MsSqlContext
+ public class DataContext : PostgreSQLContext
{
private const string Schema = "vouchers";
@@ -34,11 +34,7 @@ public DataContext(DbConnection dbConnection)
public DbSet Operations { get; set; }
- protected override void OnLykkeConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- }
-
- protected override void OnLykkeModelCreating(ModelBuilder modelBuilder)
+ protected override void OnMAVNModelCreating(ModelBuilder modelBuilder)
{
// Vouchers
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/MAVN.Service.Vouchers.MsSqlRepositories.csproj b/src/MAVN.Service.Vouchers.MsSqlRepositories/MAVN.Service.Vouchers.MsSqlRepositories.csproj
index a058f56..56978e1 100644
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/MAVN.Service.Vouchers.MsSqlRepositories.csproj
+++ b/src/MAVN.Service.Vouchers.MsSqlRepositories/MAVN.Service.Vouchers.MsSqlRepositories.csproj
@@ -1,11 +1,15 @@
- netcoreapp2.2
+ netcoreapp3.1
1.0.0
-
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
true
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191205070533_Initial.Designer.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191205070533_Initial.Designer.cs
deleted file mode 100644
index a69561f..0000000
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191205070533_Initial.Designer.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-//
-using System;
-using MAVN.Service.Vouchers.MsSqlRepositories.Context;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-namespace MAVN.Service.Vouchers.MsSqlRepositories.Migrations
-{
- [DbContext(typeof(DataContext))]
- [Migration("20191205070533_Initial")]
- partial class Initial
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasDefaultSchema("vouchers")
- .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
- .HasAnnotation("Relational:MaxIdentifierLength", 128)
- .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("CustomerId")
- .HasColumnName("customer_id");
-
- b.Property("VoucherId")
- .HasColumnName("voucher_id");
-
- b.HasKey("Id");
-
- b.HasIndex("VoucherId")
- .IsUnique();
-
- b.ToTable("customer_vouchers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("Amount")
- .IsRequired()
- .HasColumnName("amount");
-
- b.Property("Created")
- .HasColumnName("created");
-
- b.Property("CustomerId")
- .HasColumnName("customer_id");
-
- b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
-
- b.Property("Status")
- .HasColumnName("status");
-
- b.Property("VoucherId")
- .HasColumnName("voucher_id");
-
- b.HasKey("Id");
-
- b.HasIndex("VoucherId");
-
- b.ToTable("transfers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("Code")
- .IsRequired()
- .HasColumnName("code")
- .HasColumnType("varchar(10)");
-
- b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
-
- b.Property("Status")
- .HasColumnName("status");
-
- b.HasKey("Id");
-
- b.ToTable("vouchers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
- {
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
- .WithOne("CustomerVoucher")
- .HasForeignKey("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", "VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", b =>
- {
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
- .WithMany()
- .HasForeignKey("VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209143919_PurchaseDetails.Designer.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209143919_PurchaseDetails.Designer.cs
deleted file mode 100644
index a88ec44..0000000
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209143919_PurchaseDetails.Designer.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-//
-using System;
-using MAVN.Service.Vouchers.MsSqlRepositories.Context;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-namespace MAVN.Service.Vouchers.MsSqlRepositories.Migrations
-{
- [DbContext(typeof(DataContext))]
- [Migration("20191209143919_PurchaseDetails")]
- partial class PurchaseDetails
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasDefaultSchema("vouchers")
- .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
- .HasAnnotation("Relational:MaxIdentifierLength", 128)
- .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("AmountInBaseCurrency")
- .HasColumnName("amount_in_base_currency");
-
- b.Property("AmountInTokens")
- .IsRequired()
- .HasColumnName("amount_in_tokens");
-
- b.Property("CustomerId")
- .HasColumnName("customer_id");
-
- b.Property("PurchaseDate")
- .HasColumnName("purchase_date");
-
- b.Property("VoucherId")
- .HasColumnName("voucher_id");
-
- b.HasKey("Id");
-
- b.HasIndex("CustomerId");
-
- b.HasIndex("VoucherId")
- .IsUnique();
-
- b.ToTable("customer_vouchers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("Amount")
- .IsRequired()
- .HasColumnName("amount");
-
- b.Property("Created")
- .HasColumnName("created");
-
- b.Property("CustomerId")
- .HasColumnName("customer_id");
-
- b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
-
- b.Property("Status")
- .HasColumnName("status");
-
- b.Property("VoucherId")
- .HasColumnName("voucher_id");
-
- b.HasKey("Id");
-
- b.HasIndex("VoucherId");
-
- b.ToTable("transfers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("Code")
- .IsRequired()
- .HasColumnName("code")
- .HasColumnType("varchar(10)");
-
- b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
-
- b.Property("Status")
- .HasColumnName("status");
-
- b.HasKey("Id");
-
- b.HasIndex("SpendRuleId");
-
- b.ToTable("vouchers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
- {
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
- .WithOne("CustomerVoucher")
- .HasForeignKey("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", "VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", b =>
- {
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
- .WithMany()
- .HasForeignKey("VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209143919_PurchaseDetails.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209143919_PurchaseDetails.cs
deleted file mode 100644
index 887b309..0000000
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209143919_PurchaseDetails.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace MAVN.Service.Vouchers.MsSqlRepositories.Migrations
-{
- public partial class PurchaseDetails : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "amount_in_base_currency",
- schema: "vouchers",
- table: "customer_vouchers",
- nullable: false,
- defaultValue: 0m);
-
- migrationBuilder.AddColumn(
- name: "amount_in_tokens",
- schema: "vouchers",
- table: "customer_vouchers",
- nullable: false,
- defaultValue: "");
-
- migrationBuilder.AddColumn(
- name: "purchase_date",
- schema: "vouchers",
- table: "customer_vouchers",
- nullable: false,
- defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
-
- migrationBuilder.CreateIndex(
- name: "IX_vouchers_spend_rule_id",
- schema: "vouchers",
- table: "vouchers",
- column: "spend_rule_id");
-
- migrationBuilder.CreateIndex(
- name: "IX_customer_vouchers_customer_id",
- schema: "vouchers",
- table: "customer_vouchers",
- column: "customer_id");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_vouchers_spend_rule_id",
- schema: "vouchers",
- table: "vouchers");
-
- migrationBuilder.DropIndex(
- name: "IX_customer_vouchers_customer_id",
- schema: "vouchers",
- table: "customer_vouchers");
-
- migrationBuilder.DropColumn(
- name: "amount_in_base_currency",
- schema: "vouchers",
- table: "customer_vouchers");
-
- migrationBuilder.DropColumn(
- name: "amount_in_tokens",
- schema: "vouchers",
- table: "customer_vouchers");
-
- migrationBuilder.DropColumn(
- name: "purchase_date",
- schema: "vouchers",
- table: "customer_vouchers");
- }
- }
-}
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209150714_UniqueVoucherCode.Designer.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209150714_UniqueVoucherCode.Designer.cs
deleted file mode 100644
index 4b1047e..0000000
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209150714_UniqueVoucherCode.Designer.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-using System;
-using MAVN.Service.Vouchers.MsSqlRepositories.Context;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-namespace MAVN.Service.Vouchers.MsSqlRepositories.Migrations
-{
- [DbContext(typeof(DataContext))]
- [Migration("20191209150714_UniqueVoucherCode")]
- partial class UniqueVoucherCode
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasDefaultSchema("vouchers")
- .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
- .HasAnnotation("Relational:MaxIdentifierLength", 128)
- .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("AmountInBaseCurrency")
- .HasColumnName("amount_in_base_currency");
-
- b.Property("AmountInTokens")
- .IsRequired()
- .HasColumnName("amount_in_tokens");
-
- b.Property("CustomerId")
- .HasColumnName("customer_id");
-
- b.Property("PurchaseDate")
- .HasColumnName("purchase_date");
-
- b.Property("VoucherId")
- .HasColumnName("voucher_id");
-
- b.HasKey("Id");
-
- b.HasIndex("CustomerId");
-
- b.HasIndex("VoucherId")
- .IsUnique();
-
- b.ToTable("customer_vouchers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("Amount")
- .IsRequired()
- .HasColumnName("amount");
-
- b.Property("Created")
- .HasColumnName("created");
-
- b.Property("CustomerId")
- .HasColumnName("customer_id");
-
- b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
-
- b.Property("Status")
- .HasColumnName("status");
-
- b.Property("VoucherId")
- .HasColumnName("voucher_id");
-
- b.HasKey("Id");
-
- b.HasIndex("VoucherId");
-
- b.ToTable("transfers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("Code")
- .IsRequired()
- .HasColumnName("code")
- .HasColumnType("varchar(10)");
-
- b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
-
- b.Property("Status")
- .HasColumnName("status");
-
- b.HasKey("Id");
-
- b.HasIndex("Code")
- .IsUnique();
-
- b.HasIndex("SpendRuleId");
-
- b.ToTable("vouchers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
- {
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
- .WithOne("CustomerVoucher")
- .HasForeignKey("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", "VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", b =>
- {
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
- .WithMany()
- .HasForeignKey("VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209150714_UniqueVoucherCode.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209150714_UniqueVoucherCode.cs
deleted file mode 100644
index cd2c49e..0000000
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191209150714_UniqueVoucherCode.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace MAVN.Service.Vouchers.MsSqlRepositories.Migrations
-{
- public partial class UniqueVoucherCode : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateIndex(
- name: "IX_vouchers_code",
- schema: "vouchers",
- table: "vouchers",
- column: "code",
- unique: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_vouchers_code",
- schema: "vouchers",
- table: "vouchers");
- }
- }
-}
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191210214622_VoucherCodeLength.Designer.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191210214622_VoucherCodeLength.Designer.cs
deleted file mode 100644
index 59a3e59..0000000
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191210214622_VoucherCodeLength.Designer.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-using System;
-using MAVN.Service.Vouchers.MsSqlRepositories.Context;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-namespace MAVN.Service.Vouchers.MsSqlRepositories.Migrations
-{
- [DbContext(typeof(DataContext))]
- [Migration("20191210214622_VoucherCodeLength")]
- partial class VoucherCodeLength
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasDefaultSchema("vouchers")
- .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
- .HasAnnotation("Relational:MaxIdentifierLength", 128)
- .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("AmountInBaseCurrency")
- .HasColumnName("amount_in_base_currency");
-
- b.Property("AmountInTokens")
- .IsRequired()
- .HasColumnName("amount_in_tokens");
-
- b.Property("CustomerId")
- .HasColumnName("customer_id");
-
- b.Property("PurchaseDate")
- .HasColumnName("purchase_date");
-
- b.Property("VoucherId")
- .HasColumnName("voucher_id");
-
- b.HasKey("Id");
-
- b.HasIndex("CustomerId");
-
- b.HasIndex("VoucherId")
- .IsUnique();
-
- b.ToTable("customer_vouchers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("Amount")
- .IsRequired()
- .HasColumnName("amount");
-
- b.Property("Created")
- .HasColumnName("created");
-
- b.Property("CustomerId")
- .HasColumnName("customer_id");
-
- b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
-
- b.Property("Status")
- .HasColumnName("status");
-
- b.Property("VoucherId")
- .HasColumnName("voucher_id");
-
- b.HasKey("Id");
-
- b.HasIndex("VoucherId");
-
- b.ToTable("transfers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property("Code")
- .IsRequired()
- .HasColumnName("code")
- .HasColumnType("varchar(15)");
-
- b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
-
- b.Property("Status")
- .HasColumnName("status");
-
- b.HasKey("Id");
-
- b.HasIndex("Code")
- .IsUnique();
-
- b.HasIndex("SpendRuleId");
-
- b.ToTable("vouchers");
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
- {
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
- .WithOne("CustomerVoucher")
- .HasForeignKey("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", "VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", b =>
- {
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
- .WithMany()
- .HasForeignKey("VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191210214622_VoucherCodeLength.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191210214622_VoucherCodeLength.cs
deleted file mode 100644
index 42e9e4b..0000000
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191210214622_VoucherCodeLength.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace MAVN.Service.Vouchers.MsSqlRepositories.Migrations
-{
- public partial class VoucherCodeLength : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterColumn(
- name: "code",
- schema: "vouchers",
- table: "vouchers",
- type: "varchar(15)",
- nullable: false,
- oldClrType: typeof(string),
- oldType: "varchar(10)");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterColumn(
- name: "code",
- schema: "vouchers",
- table: "vouchers",
- type: "varchar(10)",
- nullable: false,
- oldClrType: typeof(string),
- oldType: "varchar(15)");
- }
- }
-}
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191219060252_Operations.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191219060252_Operations.cs
deleted file mode 100644
index 7d66a3c..0000000
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191219060252_Operations.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace MAVN.Service.Vouchers.MsSqlRepositories.Migrations
-{
- public partial class Operations : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "operations",
- schema: "vouchers",
- columns: table => new
- {
- id = table.Column(nullable: false),
- transfer_id = table.Column(nullable: false),
- type = table.Column(nullable: false),
- status = table.Column(nullable: false),
- created = table.Column(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_operations", x => x.id);
- table.ForeignKey(
- name: "FK_operations_transfers_transfer_id",
- column: x => x.transfer_id,
- principalSchema: "vouchers",
- principalTable: "transfers",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_operations_transfer_id",
- schema: "vouchers",
- table: "operations",
- column: "transfer_id");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "operations",
- schema: "vouchers");
- }
- }
-}
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191219060252_Operations.Designer.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20200701111402_Initial.Designer.cs
similarity index 61%
rename from src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191219060252_Operations.Designer.cs
rename to src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20200701111402_Initial.Designer.cs
index 1a44f59..789cf89 100644
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191219060252_Operations.Designer.cs
+++ b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20200701111402_Initial.Designer.cs
@@ -1,48 +1,54 @@
-//
+//
using System;
using MAVN.Service.Vouchers.MsSqlRepositories.Context;
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.Vouchers.MsSqlRepositories.Migrations
{
[DbContext(typeof(DataContext))]
- [Migration("20191219060252_Operations")]
- partial class Operations
+ [Migration("20200701111402_Initial")]
+ partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("vouchers")
- .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
- .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.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnName("id");
+ .HasColumnName("id")
+ .HasColumnType("uuid");
b.Property("AmountInBaseCurrency")
- .HasColumnName("amount_in_base_currency");
+ .HasColumnName("amount_in_base_currency")
+ .HasColumnType("numeric");
b.Property("AmountInTokens")
.IsRequired()
- .HasColumnName("amount_in_tokens");
+ .HasColumnName("amount_in_tokens")
+ .HasColumnType("text");
b.Property("CustomerId")
- .HasColumnName("customer_id");
+ .HasColumnName("customer_id")
+ .HasColumnType("uuid");
b.Property("PurchaseDate")
- .HasColumnName("purchase_date");
+ .HasColumnName("purchase_date")
+ .HasColumnType("timestamp without time zone");
b.Property("VoucherId")
- .HasColumnName("voucher_id");
+ .HasColumnName("voucher_id")
+ .HasColumnType("uuid");
b.HasKey("Id");
@@ -58,19 +64,24 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnName("id");
+ .HasColumnName("id")
+ .HasColumnType("uuid");
b.Property("Created")
- .HasColumnName("created");
+ .HasColumnName("created")
+ .HasColumnType("timestamp without time zone");
b.Property("Status")
- .HasColumnName("status");
+ .HasColumnName("status")
+ .HasColumnType("smallint");
b.Property("TransferId")
- .HasColumnName("transfer_id");
+ .HasColumnName("transfer_id")
+ .HasColumnType("uuid");
b.Property("Type")
- .HasColumnName("type");
+ .HasColumnName("type")
+ .HasColumnType("smallint");
b.HasKey("Id");
@@ -83,26 +94,33 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnName("id");
+ .HasColumnName("id")
+ .HasColumnType("uuid");
b.Property("Amount")
.IsRequired()
- .HasColumnName("amount");
+ .HasColumnName("amount")
+ .HasColumnType("text");
b.Property("Created")
- .HasColumnName("created");
+ .HasColumnName("created")
+ .HasColumnType("timestamp without time zone");
b.Property("CustomerId")
- .HasColumnName("customer_id");
+ .HasColumnName("customer_id")
+ .HasColumnType("uuid");
b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
+ .HasColumnName("spend_rule_id")
+ .HasColumnType("uuid");
b.Property("Status")
- .HasColumnName("status");
+ .HasColumnName("status")
+ .HasColumnType("smallint");
b.Property("VoucherId")
- .HasColumnName("voucher_id");
+ .HasColumnName("voucher_id")
+ .HasColumnType("uuid");
b.HasKey("Id");
@@ -115,7 +133,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnName("id");
+ .HasColumnName("id")
+ .HasColumnType("uuid");
b.Property("Code")
.IsRequired()
@@ -123,10 +142,12 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
.HasColumnType("varchar(15)");
b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
+ .HasColumnName("spend_rule_id")
+ .HasColumnType("uuid");
b.Property("Status")
- .HasColumnName("status");
+ .HasColumnName("status")
+ .HasColumnType("smallint");
b.HasKey("Id");
@@ -140,26 +161,29 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
{
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
+ b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity", null)
.WithOne("CustomerVoucher")
.HasForeignKey("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", "VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.OperationEntity", b =>
{
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity")
+ b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", null)
.WithMany("Operations")
.HasForeignKey("TransferId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", b =>
{
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
+ b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity", null)
.WithMany()
.HasForeignKey("VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
#pragma warning restore 612, 618
}
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191205070533_Initial.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20200701111402_Initial.cs
similarity index 63%
rename from src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191205070533_Initial.cs
rename to src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20200701111402_Initial.cs
index 5712068..8fcf320 100644
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20191205070533_Initial.cs
+++ b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/20200701111402_Initial.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace MAVN.Service.Vouchers.MsSqlRepositories.Migrations
@@ -16,7 +16,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
columns: table => new
{
id = table.Column(nullable: false),
- code = table.Column(type: "varchar(10)", nullable: false),
+ code = table.Column(type: "varchar(15)", nullable: false),
status = table.Column(nullable: false),
spend_rule_id = table.Column(nullable: false)
},
@@ -32,7 +32,10 @@ protected override void Up(MigrationBuilder migrationBuilder)
{
id = table.Column(nullable: false),
customer_id = table.Column(nullable: false),
- voucher_id = table.Column(nullable: false)
+ voucher_id = table.Column(nullable: false),
+ amount_in_tokens = table.Column(nullable: false),
+ amount_in_base_currency = table.Column(nullable: false),
+ purchase_date = table.Column(nullable: false)
},
constraints: table =>
{
@@ -71,6 +74,35 @@ protected override void Up(MigrationBuilder migrationBuilder)
onDelete: ReferentialAction.Cascade);
});
+ migrationBuilder.CreateTable(
+ name: "operations",
+ schema: "vouchers",
+ columns: table => new
+ {
+ id = table.Column(nullable: false),
+ transfer_id = table.Column(nullable: false),
+ type = table.Column(nullable: false),
+ status = table.Column(nullable: false),
+ created = table.Column(nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_operations", x => x.id);
+ table.ForeignKey(
+ name: "FK_operations_transfers_transfer_id",
+ column: x => x.transfer_id,
+ principalSchema: "vouchers",
+ principalTable: "transfers",
+ principalColumn: "id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_customer_vouchers_customer_id",
+ schema: "vouchers",
+ table: "customer_vouchers",
+ column: "customer_id");
+
migrationBuilder.CreateIndex(
name: "IX_customer_vouchers_voucher_id",
schema: "vouchers",
@@ -78,11 +110,30 @@ protected override void Up(MigrationBuilder migrationBuilder)
column: "voucher_id",
unique: true);
+ migrationBuilder.CreateIndex(
+ name: "IX_operations_transfer_id",
+ schema: "vouchers",
+ table: "operations",
+ column: "transfer_id");
+
migrationBuilder.CreateIndex(
name: "IX_transfers_voucher_id",
schema: "vouchers",
table: "transfers",
column: "voucher_id");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_vouchers_code",
+ schema: "vouchers",
+ table: "vouchers",
+ column: "code",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_vouchers_spend_rule_id",
+ schema: "vouchers",
+ table: "vouchers",
+ column: "spend_rule_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
@@ -91,6 +142,10 @@ protected override void Down(MigrationBuilder migrationBuilder)
name: "customer_vouchers",
schema: "vouchers");
+ migrationBuilder.DropTable(
+ name: "operations",
+ schema: "vouchers");
+
migrationBuilder.DropTable(
name: "transfers",
schema: "vouchers");
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/DataContextModelSnapshot.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/DataContextModelSnapshot.cs
index 996aadf..6d54095 100644
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/DataContextModelSnapshot.cs
+++ b/src/MAVN.Service.Vouchers.MsSqlRepositories/Migrations/DataContextModelSnapshot.cs
@@ -1,10 +1,10 @@
-//
+//
using System;
using MAVN.Service.Vouchers.MsSqlRepositories.Context;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace MAVN.Service.Vouchers.MsSqlRepositories.Migrations
{
@@ -16,31 +16,37 @@ protected override void BuildModel(ModelBuilder modelBuilder)
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("vouchers")
- .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
- .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.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnName("id");
+ .HasColumnName("id")
+ .HasColumnType("uuid");
b.Property("AmountInBaseCurrency")
- .HasColumnName("amount_in_base_currency");
+ .HasColumnName("amount_in_base_currency")
+ .HasColumnType("numeric");
b.Property("AmountInTokens")
.IsRequired()
- .HasColumnName("amount_in_tokens");
+ .HasColumnName("amount_in_tokens")
+ .HasColumnType("text");
b.Property("CustomerId")
- .HasColumnName("customer_id");
+ .HasColumnName("customer_id")
+ .HasColumnType("uuid");
b.Property("PurchaseDate")
- .HasColumnName("purchase_date");
+ .HasColumnName("purchase_date")
+ .HasColumnType("timestamp without time zone");
b.Property("VoucherId")
- .HasColumnName("voucher_id");
+ .HasColumnName("voucher_id")
+ .HasColumnType("uuid");
b.HasKey("Id");
@@ -56,19 +62,24 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnName("id");
+ .HasColumnName("id")
+ .HasColumnType("uuid");
b.Property("Created")
- .HasColumnName("created");
+ .HasColumnName("created")
+ .HasColumnType("timestamp without time zone");
b.Property("Status")
- .HasColumnName("status");
+ .HasColumnName("status")
+ .HasColumnType("smallint");
b.Property("TransferId")
- .HasColumnName("transfer_id");
+ .HasColumnName("transfer_id")
+ .HasColumnType("uuid");
b.Property("Type")
- .HasColumnName("type");
+ .HasColumnName("type")
+ .HasColumnType("smallint");
b.HasKey("Id");
@@ -81,26 +92,33 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnName("id");
+ .HasColumnName("id")
+ .HasColumnType("uuid");
b.Property("Amount")
.IsRequired()
- .HasColumnName("amount");
+ .HasColumnName("amount")
+ .HasColumnType("text");
b.Property("Created")
- .HasColumnName("created");
+ .HasColumnName("created")
+ .HasColumnType("timestamp without time zone");
b.Property("CustomerId")
- .HasColumnName("customer_id");
+ .HasColumnName("customer_id")
+ .HasColumnType("uuid");
b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
+ .HasColumnName("spend_rule_id")
+ .HasColumnType("uuid");
b.Property("Status")
- .HasColumnName("status");
+ .HasColumnName("status")
+ .HasColumnType("smallint");
b.Property("VoucherId")
- .HasColumnName("voucher_id");
+ .HasColumnName("voucher_id")
+ .HasColumnType("uuid");
b.HasKey("Id");
@@ -113,7 +131,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnName("id");
+ .HasColumnName("id")
+ .HasColumnType("uuid");
b.Property("Code")
.IsRequired()
@@ -121,10 +140,12 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("varchar(15)");
b.Property("SpendRuleId")
- .HasColumnName("spend_rule_id");
+ .HasColumnName("spend_rule_id")
+ .HasColumnType("uuid");
b.Property("Status")
- .HasColumnName("status");
+ .HasColumnName("status")
+ .HasColumnType("smallint");
b.HasKey("Id");
@@ -138,26 +159,29 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", b =>
{
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
+ b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity", null)
.WithOne("CustomerVoucher")
.HasForeignKey("MAVN.Service.Vouchers.MsSqlRepositories.Entities.CustomerVoucherEntity", "VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.OperationEntity", b =>
{
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity")
+ b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", null)
.WithMany("Operations")
.HasForeignKey("TransferId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
modelBuilder.Entity("MAVN.Service.Vouchers.MsSqlRepositories.Entities.TransferEntity", b =>
{
- b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity")
+ b.HasOne("MAVN.Service.Vouchers.MsSqlRepositories.Entities.VoucherEntity", null)
.WithMany()
.HasForeignKey("VoucherId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
#pragma warning restore 612, 618
}
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/OperationsRepository.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/OperationsRepository.cs
index 74e9cac..a9639e8 100644
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/OperationsRepository.cs
+++ b/src/MAVN.Service.Vouchers.MsSqlRepositories/OperationsRepository.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.Vouchers.Domain.Entities;
using MAVN.Service.Vouchers.Domain.Repositories;
using MAVN.Service.Vouchers.MsSqlRepositories.Context;
@@ -13,10 +13,10 @@ namespace MAVN.Service.Vouchers.MsSqlRepositories
{
public class OperationsRepository : IOperationsRepository
{
- private readonly MsSqlContextFactory _contextFactory;
+ private readonly PostgreSQLContextFactory _contextFactory;
private readonly IMapper _mapper;
- public OperationsRepository(MsSqlContextFactory contextFactory, IMapper mapper)
+ public OperationsRepository(PostgreSQLContextFactory contextFactory, IMapper mapper)
{
_contextFactory = contextFactory;
_mapper = mapper;
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/TransfersRepository.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/TransfersRepository.cs
index 8e75983..7b1767c 100644
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/TransfersRepository.cs
+++ b/src/MAVN.Service.Vouchers.MsSqlRepositories/TransfersRepository.cs
@@ -1,7 +1,7 @@
using System;
using System.Threading.Tasks;
using AutoMapper;
-using MAVN.Common.MsSql;
+using MAVN.Persistence.PostgreSQL.Legacy;
using MAVN.Service.Vouchers.Domain.Entities;
using MAVN.Service.Vouchers.Domain.Repositories;
using MAVN.Service.Vouchers.MsSqlRepositories.Context;
@@ -11,10 +11,10 @@ namespace MAVN.Service.Vouchers.MsSqlRepositories
{
public class TransfersRepository : ITransfersRepository
{
- private readonly MsSqlContextFactory _contextFactory;
+ private readonly PostgreSQLContextFactory _contextFactory;
private readonly IMapper _mapper;
- public TransfersRepository(MsSqlContextFactory contextFactory, IMapper mapper)
+ public TransfersRepository(PostgreSQLContextFactory contextFactory, IMapper mapper)
{
_contextFactory = contextFactory;
_mapper = mapper;
diff --git a/src/MAVN.Service.Vouchers.MsSqlRepositories/VouchersRepository.cs b/src/MAVN.Service.Vouchers.MsSqlRepositories/VouchersRepository.cs
index 61fbdda..06c6fc1 100644
--- a/src/MAVN.Service.Vouchers.MsSqlRepositories/VouchersRepository.cs
+++ b/src/MAVN.Service.Vouchers.MsSqlRepositories/VouchersRepository.cs
@@ -6,13 +6,14 @@
using AutoMapper;
using Common.Log;
using Lykke.Common.Log;
-using MAVN.Common.MsSql;
+using MAVN.Persistence.PostgreSQL.Legacy;
using MAVN.Service.Vouchers.Domain.Entities;
using MAVN.Service.Vouchers.Domain.Exceptions;
using MAVN.Service.Vouchers.Domain.Repositories;
using MAVN.Service.Vouchers.MsSqlRepositories.Context;
using MAVN.Service.Vouchers.MsSqlRepositories.Entities;
using Microsoft.EntityFrameworkCore;
+using Npgsql;
namespace MAVN.Service.Vouchers.MsSqlRepositories
{
@@ -20,12 +21,12 @@ public class VouchersRepository : IVouchersRepository
{
private const int ViolationInUniqueIndexErrorCode = 2601;
- private readonly MsSqlContextFactory _contextFactory;
+ private readonly PostgreSQLContextFactory _contextFactory;
private readonly ILog _log;
private readonly IMapper _mapper;
public VouchersRepository(
- MsSqlContextFactory contextFactory,
+ PostgreSQLContextFactory contextFactory,
ILogFactory logFactory,
IMapper mapper)
{
@@ -139,7 +140,7 @@ public async Task InsertAsync(IReadOnlyList vouchers)
transaction.Commit();
}
catch (DbUpdateException exception)
- when ((exception.InnerException as SqlException)?.Number == ViolationInUniqueIndexErrorCode)
+ when ((exception.InnerException as PostgresException)?.SqlState == PostgresErrorCodes.UniqueViolation)
{
throw new CodeAlreadyExistException();
}
diff --git a/src/MAVN.Service.Vouchers/Dockerfile b/src/MAVN.Service.Vouchers/Dockerfile
index 88770e7..83a5c60 100644
--- a/src/MAVN.Service.Vouchers/Dockerfile
+++ b/src/MAVN.Service.Vouchers/Dockerfile
@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-aspnetcore-runtime
+FROM microsoft/dotnet:3.1-aspnetcore-runtime
WORKDIR /app
COPY . .
ENTRYPOINT ["dotnet", "MAVN.Service.Vouchers.dll"]
diff --git a/src/MAVN.Service.Vouchers/MAVN.Service.Vouchers.csproj b/src/MAVN.Service.Vouchers/MAVN.Service.Vouchers.csproj
index 6a95c55..e868ae3 100644
--- a/src/MAVN.Service.Vouchers/MAVN.Service.Vouchers.csproj
+++ b/src/MAVN.Service.Vouchers/MAVN.Service.Vouchers.csproj
@@ -1,6 +1,6 @@
-
+
- netcoreapp2.2
+ netcoreapp3.1
Exe
1.0.0
@@ -24,7 +24,8 @@
-
+
+
diff --git a/tests/MAVN.Service.Vouchers.DomainServices.Tests/MAVN.Service.Vouchers.DomainServices.Tests.csproj b/tests/MAVN.Service.Vouchers.DomainServices.Tests/MAVN.Service.Vouchers.DomainServices.Tests.csproj
index d42c4b0..36894c4 100644
--- a/tests/MAVN.Service.Vouchers.DomainServices.Tests/MAVN.Service.Vouchers.DomainServices.Tests.csproj
+++ b/tests/MAVN.Service.Vouchers.DomainServices.Tests/MAVN.Service.Vouchers.DomainServices.Tests.csproj
@@ -1,14 +1,14 @@
-
+
- netcoreapp2.2
+ netcoreapp3.1
false
1.0.0
-
-
+
+
-
+
all
runtime; build; native; contentfiles; analyzers
diff --git a/tests/MAVN.Service.Vouchers.MsSqlRepositories.Tests/MAVN.Service.Vouchers.MsSqlRepositories.Tests.csproj b/tests/MAVN.Service.Vouchers.MsSqlRepositories.Tests/MAVN.Service.Vouchers.MsSqlRepositories.Tests.csproj
index c6ada1d..987f3e5 100644
--- a/tests/MAVN.Service.Vouchers.MsSqlRepositories.Tests/MAVN.Service.Vouchers.MsSqlRepositories.Tests.csproj
+++ b/tests/MAVN.Service.Vouchers.MsSqlRepositories.Tests/MAVN.Service.Vouchers.MsSqlRepositories.Tests.csproj
@@ -1,14 +1,14 @@
-
+
- netcoreapp2.2
+ netcoreapp3.1
false
1.0.0
-
-
+
+
-
+
all
runtime; build; native; contentfiles; analyzers
diff --git a/tests/MAVN.Service.Vouchers.Tests/MAVN.Service.Vouchers.Tests.csproj b/tests/MAVN.Service.Vouchers.Tests/MAVN.Service.Vouchers.Tests.csproj
index 4da0c8a..8ce9549 100644
--- a/tests/MAVN.Service.Vouchers.Tests/MAVN.Service.Vouchers.Tests.csproj
+++ b/tests/MAVN.Service.Vouchers.Tests/MAVN.Service.Vouchers.Tests.csproj
@@ -1,17 +1,17 @@
- netcoreapp2.2
+ netcoreapp3.1
1.0.0
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
-
+
+
-
+
all
runtime; build; native; contentfiles; analyzers