From 56d545082b0d009a6d8edcccceffd684e1e4f1b7 Mon Sep 17 00:00:00 2001 From: Iliyan Iliev Date: Mon, 6 Jul 2020 10:48:07 +0300 Subject: [PATCH] Closes #37 --- .../MAVN.Job.SmartVouchers.csproj | 1 + .../Modules/DbModule.cs | 4 +- ...ice.SmartVouchers.MsSqlRepositories.csproj | 2 +- ...0200406222041_InitialMigration.Designer.cs | 214 ---------------- ...00428181231_AddPaymentRequests.Designer.cs | 230 ----------------- .../20200428181231_AddPaymentRequests.cs | 47 ---- ...200429095915_MakeOwnerNullable.Designer.cs | 230 ----------------- .../20200429095915_MakeOwnerNullable.cs | 31 --- ...0513063747_AddIndexByShortCode.Designer.cs | 232 ------------------ .../20200513063747_AddIndexByShortCode.cs | 40 --- ...rIdAndRemoveValidationCodeHash.Designer.cs | 231 ----------------- ..._AddSellerIdAndRemoveValidationCodeHash.cs | 38 --- ...0605103903_AddExpirationDateToCampaings.cs | 25 -- ....cs => 20200706074721_Initial.Designer.cs} | 73 +++--- ...Migration.cs => 20200706074721_Initial.cs} | 40 ++- .../SmartVouchersContextModelSnapshot.cs | 69 +++--- .../CampaignContentsRepository.cs | 2 +- .../Repositories/CampaignsRepository.cs | 2 +- .../Repositories/PaymentRequestsRepository.cs | 2 +- .../Repositories/VouchersRepository.cs | 2 +- .../SmartVouchersContext.cs | 6 +- .../MAVN.Service.SmartVouchers.csproj | 1 + .../Modules/DbModule.cs | 4 +- 23 files changed, 116 insertions(+), 1410 deletions(-) delete mode 100644 src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200406222041_InitialMigration.Designer.cs delete mode 100644 src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200428181231_AddPaymentRequests.Designer.cs delete mode 100644 src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200428181231_AddPaymentRequests.cs delete mode 100644 src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200429095915_MakeOwnerNullable.Designer.cs delete mode 100644 src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200429095915_MakeOwnerNullable.cs delete mode 100644 src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200513063747_AddIndexByShortCode.Designer.cs delete mode 100644 src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200513063747_AddIndexByShortCode.cs delete mode 100644 src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200529120054_AddSellerIdAndRemoveValidationCodeHash.Designer.cs delete mode 100644 src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200529120054_AddSellerIdAndRemoveValidationCodeHash.cs delete mode 100644 src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200605103903_AddExpirationDateToCampaings.cs rename src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/{20200605103903_AddExpirationDateToCampaings.Designer.cs => 20200706074721_Initial.Designer.cs} (76%) rename src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/{20200406222041_InitialMigration.cs => 20200706074721_Initial.cs} (80%) diff --git a/src/MAVN.Job.SmartVouchers/MAVN.Job.SmartVouchers.csproj b/src/MAVN.Job.SmartVouchers/MAVN.Job.SmartVouchers.csproj index 495a4ff..34ebca8 100644 --- a/src/MAVN.Job.SmartVouchers/MAVN.Job.SmartVouchers.csproj +++ b/src/MAVN.Job.SmartVouchers/MAVN.Job.SmartVouchers.csproj @@ -26,6 +26,7 @@ + diff --git a/src/MAVN.Job.SmartVouchers/Modules/DbModule.cs b/src/MAVN.Job.SmartVouchers/Modules/DbModule.cs index 8563d8b..471933e 100644 --- a/src/MAVN.Job.SmartVouchers/Modules/DbModule.cs +++ b/src/MAVN.Job.SmartVouchers/Modules/DbModule.cs @@ -4,9 +4,9 @@ using AzureStorage.Tables; using JetBrains.Annotations; using Lykke.Common.Log; -using MAVN.Common.MsSql; using Lykke.SettingsReader; using MAVN.Job.SmartVouchers.Settings; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.SmartVouchers.AzureRepositories; using MAVN.Service.SmartVouchers.AzureRepositories.Entities; using MAVN.Service.SmartVouchers.Domain.Repositories; @@ -47,7 +47,7 @@ protected override void Load(ContainerBuilder builder) .As() .SingleInstance(); - builder.RegisterMsSql( + builder.RegisterPostgreSQL( _connectionString, connString => new SmartVouchersContext(connString, false), dbConn => new SmartVouchersContext(dbConn)); diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/MAVN.Service.SmartVouchers.MsSqlRepositories.csproj b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/MAVN.Service.SmartVouchers.MsSqlRepositories.csproj index 0e283e9..a96013f 100644 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/MAVN.Service.SmartVouchers.MsSqlRepositories.csproj +++ b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/MAVN.Service.SmartVouchers.MsSqlRepositories.csproj @@ -7,7 +7,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200406222041_InitialMigration.Designer.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200406222041_InitialMigration.Designer.cs deleted file mode 100644 index bbe4817..0000000 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200406222041_InitialMigration.Designer.cs +++ /dev/null @@ -1,214 +0,0 @@ -// -using System; -using MAVN.Service.SmartVouchers.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.SmartVouchers.MsSqlRepositories.Migrations -{ - [DbContext(typeof(SmartVouchersContext))] - [Migration("20200406222041_InitialMigration")] - partial class InitialMigration - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("smart_vouchers") - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignContentEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("CampaignId") - .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); - - b.Property("ContentType") - .HasColumnName("content_type") - .HasColumnType("int"); - - b.Property("Language") - .HasColumnName("language") - .HasColumnType("int"); - - b.Property("Value") - .HasColumnName("value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CampaignId"); - - b.ToTable("campaign_content"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("BoughtVouchersCount") - .HasColumnName("bought_vouchers_count") - .HasColumnType("int"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnName("created_by") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationDate") - .HasColumnName("creation_date") - .HasColumnType("datetime2"); - - b.Property("Currency") - .IsRequired() - .HasColumnName("currency") - .HasColumnType("nvarchar(max)"); - - b.Property("Description") - .HasColumnName("description") - .HasColumnType("nvarchar(max)"); - - b.Property("FromDate") - .HasColumnName("from_date") - .HasColumnType("datetime2"); - - b.Property("Name") - .IsRequired() - .HasColumnName("name") - .HasColumnType("nvarchar(max)"); - - b.Property("PartnerId") - .IsRequired() - .HasColumnName("partner_id") - .HasColumnType("nvarchar(max)"); - - b.Property("State") - .HasColumnName("state") - .HasColumnType("smallint"); - - b.Property("ToDate") - .HasColumnName("to_date") - .HasColumnType("datetime2"); - - b.Property("VoucherPrice") - .HasColumnName("voucher_price") - .HasColumnType("decimal(18,2)"); - - b.Property("VouchersTotalCount") - .HasColumnName("vouchers_total_count") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("campaign"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("CampaignId") - .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); - - b.Property("OwnerId") - .HasColumnName("owner_id") - .HasColumnType("uniqueidentifier"); - - b.Property("PurchaseDate") - .HasColumnName("purchase_date") - .HasColumnType("datetime2"); - - b.Property("RedemptionDate") - .HasColumnName("redemption_date") - .HasColumnType("datetime2"); - - b.Property("ShortCode") - .HasColumnName("short_code") - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnName("status") - .HasColumnType("smallint"); - - b.Property("ValidationCodeHash") - .IsRequired() - .HasColumnName("validation_code_hash") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CampaignId"); - - b.HasIndex("OwnerId"); - - b.HasIndex("ShortCode") - .IsUnique() - .HasFilter("[short_code] IS NOT NULL"); - - b.ToTable("voucher"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ValidationCode") - .IsRequired() - .HasColumnName("validation_code") - .HasColumnType("nvarchar(max)"); - - b.Property("VoucherId") - .HasColumnName("voucher_id") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("VoucherId") - .IsUnique(); - - b.ToTable("voucher_validation"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignContentEntity", b => - { - b.HasOne("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignEntity", null) - .WithMany("LocalizedContents") - .HasForeignKey("CampaignId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", b => - { - b.HasOne("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherEntity", null) - .WithOne("Validation") - .HasForeignKey("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", "VoucherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200428181231_AddPaymentRequests.Designer.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200428181231_AddPaymentRequests.Designer.cs deleted file mode 100644 index f748c06..0000000 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200428181231_AddPaymentRequests.Designer.cs +++ /dev/null @@ -1,230 +0,0 @@ -// -using System; -using MAVN.Service.SmartVouchers.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.SmartVouchers.MsSqlRepositories.Migrations -{ - [DbContext(typeof(SmartVouchersContext))] - [Migration("20200428181231_AddPaymentRequests")] - partial class AddPaymentRequests - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("smart_vouchers") - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.PaymentRequestEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("VoucherShortCode") - .IsRequired() - .HasColumnName("short_code") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("payment_request"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignContentEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("CampaignId") - .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); - - b.Property("ContentType") - .HasColumnName("content_type") - .HasColumnType("int"); - - b.Property("Language") - .HasColumnName("language") - .HasColumnType("int"); - - b.Property("Value") - .HasColumnName("value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CampaignId"); - - b.ToTable("campaign_content"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("BoughtVouchersCount") - .HasColumnName("bought_vouchers_count") - .HasColumnType("int"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnName("created_by") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationDate") - .HasColumnName("creation_date") - .HasColumnType("datetime2"); - - b.Property("Currency") - .IsRequired() - .HasColumnName("currency") - .HasColumnType("nvarchar(max)"); - - b.Property("Description") - .HasColumnName("description") - .HasColumnType("nvarchar(max)"); - - b.Property("FromDate") - .HasColumnName("from_date") - .HasColumnType("datetime2"); - - b.Property("Name") - .IsRequired() - .HasColumnName("name") - .HasColumnType("nvarchar(max)"); - - b.Property("PartnerId") - .HasColumnName("partner_id") - .HasColumnType("uniqueidentifier"); - - b.Property("State") - .HasColumnName("state") - .HasColumnType("smallint"); - - b.Property("ToDate") - .HasColumnName("to_date") - .HasColumnType("datetime2"); - - b.Property("VoucherPrice") - .HasColumnName("voucher_price") - .HasColumnType("decimal(18,2)"); - - b.Property("VouchersTotalCount") - .HasColumnName("vouchers_total_count") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("campaign"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("CampaignId") - .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); - - b.Property("OwnerId") - .HasColumnName("owner_id") - .HasColumnType("uniqueidentifier"); - - b.Property("PurchaseDate") - .HasColumnName("purchase_date") - .HasColumnType("datetime2"); - - b.Property("RedemptionDate") - .HasColumnName("redemption_date") - .HasColumnType("datetime2"); - - b.Property("ShortCode") - .HasColumnName("short_code") - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnName("status") - .HasColumnType("smallint"); - - b.Property("ValidationCodeHash") - .IsRequired() - .HasColumnName("validation_code_hash") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CampaignId"); - - b.HasIndex("OwnerId"); - - b.HasIndex("ShortCode") - .IsUnique() - .HasFilter("[short_code] IS NOT NULL"); - - b.ToTable("voucher"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ValidationCode") - .IsRequired() - .HasColumnName("validation_code") - .HasColumnType("nvarchar(max)"); - - b.Property("VoucherId") - .HasColumnName("voucher_id") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("VoucherId") - .IsUnique(); - - b.ToTable("voucher_validation"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignContentEntity", b => - { - b.HasOne("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignEntity", null) - .WithMany("LocalizedContents") - .HasForeignKey("CampaignId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", b => - { - b.HasOne("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherEntity", null) - .WithOne("Validation") - .HasForeignKey("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", "VoucherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200428181231_AddPaymentRequests.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200428181231_AddPaymentRequests.cs deleted file mode 100644 index 0c08f3b..0000000 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200428181231_AddPaymentRequests.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.SmartVouchers.MsSqlRepositories.Migrations -{ - public partial class AddPaymentRequests : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "partner_id", - schema: "smart_vouchers", - table: "campaign", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.CreateTable( - name: "payment_request", - schema: "smart_vouchers", - columns: table => new - { - id = table.Column(nullable: false), - short_code = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_payment_request", x => x.id); - }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "payment_request", - schema: "smart_vouchers"); - - migrationBuilder.AlterColumn( - name: "partner_id", - schema: "smart_vouchers", - table: "campaign", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(Guid)); - } - } -} diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200429095915_MakeOwnerNullable.Designer.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200429095915_MakeOwnerNullable.Designer.cs deleted file mode 100644 index 1900b8c..0000000 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200429095915_MakeOwnerNullable.Designer.cs +++ /dev/null @@ -1,230 +0,0 @@ -// -using System; -using MAVN.Service.SmartVouchers.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.SmartVouchers.MsSqlRepositories.Migrations -{ - [DbContext(typeof(SmartVouchersContext))] - [Migration("20200429095915_MakeOwnerNullable")] - partial class MakeOwnerNullable - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("smart_vouchers") - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.PaymentRequestEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("VoucherShortCode") - .IsRequired() - .HasColumnName("short_code") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("payment_request"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignContentEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("CampaignId") - .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); - - b.Property("ContentType") - .HasColumnName("content_type") - .HasColumnType("int"); - - b.Property("Language") - .HasColumnName("language") - .HasColumnType("int"); - - b.Property("Value") - .HasColumnName("value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CampaignId"); - - b.ToTable("campaign_content"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("BoughtVouchersCount") - .HasColumnName("bought_vouchers_count") - .HasColumnType("int"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnName("created_by") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationDate") - .HasColumnName("creation_date") - .HasColumnType("datetime2"); - - b.Property("Currency") - .IsRequired() - .HasColumnName("currency") - .HasColumnType("nvarchar(max)"); - - b.Property("Description") - .HasColumnName("description") - .HasColumnType("nvarchar(max)"); - - b.Property("FromDate") - .HasColumnName("from_date") - .HasColumnType("datetime2"); - - b.Property("Name") - .IsRequired() - .HasColumnName("name") - .HasColumnType("nvarchar(max)"); - - b.Property("PartnerId") - .HasColumnName("partner_id") - .HasColumnType("uniqueidentifier"); - - b.Property("State") - .HasColumnName("state") - .HasColumnType("smallint"); - - b.Property("ToDate") - .HasColumnName("to_date") - .HasColumnType("datetime2"); - - b.Property("VoucherPrice") - .HasColumnName("voucher_price") - .HasColumnType("decimal(18,2)"); - - b.Property("VouchersTotalCount") - .HasColumnName("vouchers_total_count") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("campaign"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("CampaignId") - .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); - - b.Property("OwnerId") - .HasColumnName("owner_id") - .HasColumnType("uniqueidentifier"); - - b.Property("PurchaseDate") - .HasColumnName("purchase_date") - .HasColumnType("datetime2"); - - b.Property("RedemptionDate") - .HasColumnName("redemption_date") - .HasColumnType("datetime2"); - - b.Property("ShortCode") - .HasColumnName("short_code") - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnName("status") - .HasColumnType("smallint"); - - b.Property("ValidationCodeHash") - .IsRequired() - .HasColumnName("validation_code_hash") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CampaignId"); - - b.HasIndex("OwnerId"); - - b.HasIndex("ShortCode") - .IsUnique() - .HasFilter("[short_code] IS NOT NULL"); - - b.ToTable("voucher"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ValidationCode") - .IsRequired() - .HasColumnName("validation_code") - .HasColumnType("nvarchar(max)"); - - b.Property("VoucherId") - .HasColumnName("voucher_id") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("VoucherId") - .IsUnique(); - - b.ToTable("voucher_validation"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignContentEntity", b => - { - b.HasOne("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignEntity", null) - .WithMany("LocalizedContents") - .HasForeignKey("CampaignId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", b => - { - b.HasOne("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherEntity", null) - .WithOne("Validation") - .HasForeignKey("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", "VoucherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200429095915_MakeOwnerNullable.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200429095915_MakeOwnerNullable.cs deleted file mode 100644 index e3d8428..0000000 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200429095915_MakeOwnerNullable.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.SmartVouchers.MsSqlRepositories.Migrations -{ - public partial class MakeOwnerNullable : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "owner_id", - schema: "smart_vouchers", - table: "voucher", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uniqueidentifier"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "owner_id", - schema: "smart_vouchers", - table: "voucher", - type: "uniqueidentifier", - nullable: false, - oldClrType: typeof(Guid), - oldNullable: true); - } - } -} diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200513063747_AddIndexByShortCode.Designer.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200513063747_AddIndexByShortCode.Designer.cs deleted file mode 100644 index 1774537..0000000 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200513063747_AddIndexByShortCode.Designer.cs +++ /dev/null @@ -1,232 +0,0 @@ -// -using System; -using MAVN.Service.SmartVouchers.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.SmartVouchers.MsSqlRepositories.Migrations -{ - [DbContext(typeof(SmartVouchersContext))] - [Migration("20200513063747_AddIndexByShortCode")] - partial class AddIndexByShortCode - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("smart_vouchers") - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.PaymentRequestEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("VoucherShortCode") - .IsRequired() - .HasColumnName("short_code") - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("VoucherShortCode"); - - b.ToTable("payment_request"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignContentEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("CampaignId") - .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); - - b.Property("ContentType") - .HasColumnName("content_type") - .HasColumnType("int"); - - b.Property("Language") - .HasColumnName("language") - .HasColumnType("int"); - - b.Property("Value") - .HasColumnName("value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CampaignId"); - - b.ToTable("campaign_content"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("BoughtVouchersCount") - .HasColumnName("bought_vouchers_count") - .HasColumnType("int"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnName("created_by") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationDate") - .HasColumnName("creation_date") - .HasColumnType("datetime2"); - - b.Property("Currency") - .IsRequired() - .HasColumnName("currency") - .HasColumnType("nvarchar(max)"); - - b.Property("Description") - .HasColumnName("description") - .HasColumnType("nvarchar(max)"); - - b.Property("FromDate") - .HasColumnName("from_date") - .HasColumnType("datetime2"); - - b.Property("Name") - .IsRequired() - .HasColumnName("name") - .HasColumnType("nvarchar(max)"); - - b.Property("PartnerId") - .HasColumnName("partner_id") - .HasColumnType("uniqueidentifier"); - - b.Property("State") - .HasColumnName("state") - .HasColumnType("smallint"); - - b.Property("ToDate") - .HasColumnName("to_date") - .HasColumnType("datetime2"); - - b.Property("VoucherPrice") - .HasColumnName("voucher_price") - .HasColumnType("decimal(18,2)"); - - b.Property("VouchersTotalCount") - .HasColumnName("vouchers_total_count") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("campaign"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("CampaignId") - .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); - - b.Property("OwnerId") - .HasColumnName("owner_id") - .HasColumnType("uniqueidentifier"); - - b.Property("PurchaseDate") - .HasColumnName("purchase_date") - .HasColumnType("datetime2"); - - b.Property("RedemptionDate") - .HasColumnName("redemption_date") - .HasColumnType("datetime2"); - - b.Property("ShortCode") - .HasColumnName("short_code") - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnName("status") - .HasColumnType("smallint"); - - b.Property("ValidationCodeHash") - .IsRequired() - .HasColumnName("validation_code_hash") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CampaignId"); - - b.HasIndex("OwnerId"); - - b.HasIndex("ShortCode") - .IsUnique() - .HasFilter("[short_code] IS NOT NULL"); - - b.ToTable("voucher"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ValidationCode") - .IsRequired() - .HasColumnName("validation_code") - .HasColumnType("nvarchar(max)"); - - b.Property("VoucherId") - .HasColumnName("voucher_id") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("VoucherId") - .IsUnique(); - - b.ToTable("voucher_validation"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignContentEntity", b => - { - b.HasOne("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignEntity", null) - .WithMany("LocalizedContents") - .HasForeignKey("CampaignId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", b => - { - b.HasOne("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherEntity", null) - .WithOne("Validation") - .HasForeignKey("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", "VoucherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200513063747_AddIndexByShortCode.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200513063747_AddIndexByShortCode.cs deleted file mode 100644 index 027de29..0000000 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200513063747_AddIndexByShortCode.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.SmartVouchers.MsSqlRepositories.Migrations -{ - public partial class AddIndexByShortCode : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "short_code", - schema: "smart_vouchers", - table: "payment_request", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.CreateIndex( - name: "IX_payment_request_short_code", - schema: "smart_vouchers", - table: "payment_request", - column: "short_code"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_payment_request_short_code", - schema: "smart_vouchers", - table: "payment_request"); - - migrationBuilder.AlterColumn( - name: "short_code", - schema: "smart_vouchers", - table: "payment_request", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string)); - } - } -} diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200529120054_AddSellerIdAndRemoveValidationCodeHash.Designer.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200529120054_AddSellerIdAndRemoveValidationCodeHash.Designer.cs deleted file mode 100644 index 645d603..0000000 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200529120054_AddSellerIdAndRemoveValidationCodeHash.Designer.cs +++ /dev/null @@ -1,231 +0,0 @@ -// -using System; -using MAVN.Service.SmartVouchers.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.SmartVouchers.MsSqlRepositories.Migrations -{ - [DbContext(typeof(SmartVouchersContext))] - [Migration("20200529120054_AddSellerIdAndRemoveValidationCodeHash")] - partial class AddSellerIdAndRemoveValidationCodeHash - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("smart_vouchers") - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.PaymentRequestEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("VoucherShortCode") - .IsRequired() - .HasColumnName("short_code") - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("VoucherShortCode"); - - b.ToTable("payment_request"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignContentEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("CampaignId") - .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); - - b.Property("ContentType") - .HasColumnName("content_type") - .HasColumnType("int"); - - b.Property("Language") - .HasColumnName("language") - .HasColumnType("int"); - - b.Property("Value") - .HasColumnName("value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CampaignId"); - - b.ToTable("campaign_content"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("uniqueidentifier"); - - b.Property("BoughtVouchersCount") - .HasColumnName("bought_vouchers_count") - .HasColumnType("int"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnName("created_by") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationDate") - .HasColumnName("creation_date") - .HasColumnType("datetime2"); - - b.Property("Currency") - .IsRequired() - .HasColumnName("currency") - .HasColumnType("nvarchar(max)"); - - b.Property("Description") - .HasColumnName("description") - .HasColumnType("nvarchar(max)"); - - b.Property("FromDate") - .HasColumnName("from_date") - .HasColumnType("datetime2"); - - b.Property("Name") - .IsRequired() - .HasColumnName("name") - .HasColumnType("nvarchar(max)"); - - b.Property("PartnerId") - .HasColumnName("partner_id") - .HasColumnType("uniqueidentifier"); - - b.Property("State") - .HasColumnName("state") - .HasColumnType("smallint"); - - b.Property("ToDate") - .HasColumnName("to_date") - .HasColumnType("datetime2"); - - b.Property("VoucherPrice") - .HasColumnName("voucher_price") - .HasColumnType("decimal(18,2)"); - - b.Property("VouchersTotalCount") - .HasColumnName("vouchers_total_count") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("campaign"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("CampaignId") - .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); - - b.Property("OwnerId") - .HasColumnName("owner_id") - .HasColumnType("uniqueidentifier"); - - b.Property("PurchaseDate") - .HasColumnName("purchase_date") - .HasColumnType("datetime2"); - - b.Property("RedemptionDate") - .HasColumnName("redemption_date") - .HasColumnType("datetime2"); - - b.Property("SellerId") - .HasColumnName("seller_id") - .HasColumnType("uniqueidentifier"); - - b.Property("ShortCode") - .HasColumnName("short_code") - .HasColumnType("nvarchar(450)"); - - b.Property("Status") - .HasColumnName("status") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("CampaignId"); - - b.HasIndex("OwnerId"); - - b.HasIndex("ShortCode") - .IsUnique() - .HasFilter("[short_code] IS NOT NULL"); - - b.ToTable("voucher"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ValidationCode") - .IsRequired() - .HasColumnName("validation_code") - .HasColumnType("nvarchar(max)"); - - b.Property("VoucherId") - .HasColumnName("voucher_id") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("VoucherId") - .IsUnique(); - - b.ToTable("voucher_validation"); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignContentEntity", b => - { - b.HasOne("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherCampaignEntity", null) - .WithMany("LocalizedContents") - .HasForeignKey("CampaignId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", b => - { - b.HasOne("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherEntity", null) - .WithOne("Validation") - .HasForeignKey("MAVN.Service.SmartVouchers.MsSqlRepositories.Entities.VoucherValidationEntity", "VoucherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200529120054_AddSellerIdAndRemoveValidationCodeHash.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200529120054_AddSellerIdAndRemoveValidationCodeHash.cs deleted file mode 100644 index d5766c1..0000000 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200529120054_AddSellerIdAndRemoveValidationCodeHash.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.SmartVouchers.MsSqlRepositories.Migrations -{ - public partial class AddSellerIdAndRemoveValidationCodeHash : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "validation_code_hash", - schema: "smart_vouchers", - table: "voucher"); - - migrationBuilder.AddColumn( - name: "seller_id", - schema: "smart_vouchers", - table: "voucher", - nullable: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "seller_id", - schema: "smart_vouchers", - table: "voucher"); - - migrationBuilder.AddColumn( - name: "validation_code_hash", - schema: "smart_vouchers", - table: "voucher", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200605103903_AddExpirationDateToCampaings.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200605103903_AddExpirationDateToCampaings.cs deleted file mode 100644 index 86c4281..0000000 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200605103903_AddExpirationDateToCampaings.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.SmartVouchers.MsSqlRepositories.Migrations -{ - public partial class AddExpirationDateToCampaings : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "expiration_date", - schema: "smart_vouchers", - table: "campaign", - nullable: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "expiration_date", - schema: "smart_vouchers", - table: "campaign"); - } - } -} diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200605103903_AddExpirationDateToCampaings.Designer.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200706074721_Initial.Designer.cs similarity index 76% rename from src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200605103903_AddExpirationDateToCampaings.Designer.cs rename to src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200706074721_Initial.Designer.cs index 554f737..7099cc3 100644 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200605103903_AddExpirationDateToCampaings.Designer.cs +++ b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200706074721_Initial.Designer.cs @@ -3,36 +3,36 @@ using MAVN.Service.SmartVouchers.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.SmartVouchers.MsSqlRepositories.Migrations { [DbContext(typeof(SmartVouchersContext))] - [Migration("20200605103903_AddExpirationDateToCampaings")] - partial class AddExpirationDateToCampaings + [Migration("20200706074721_Initial")] + partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("smart_vouchers") - .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.SmartVouchers.MsSqlRepositories.Entities.PaymentRequestEntity", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnName("id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("VoucherShortCode") .IsRequired() .HasColumnName("short_code") - .HasColumnType("nvarchar(450)"); + .HasColumnType("text"); b.HasKey("Id"); @@ -46,23 +46,23 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Id") .ValueGeneratedOnAdd() .HasColumnName("id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CampaignId") .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("ContentType") .HasColumnName("content_type") - .HasColumnType("int"); + .HasColumnType("integer"); b.Property("Language") .HasColumnName("language") - .HasColumnType("int"); + .HasColumnType("integer"); b.Property("Value") .HasColumnName("value") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.HasKey("Id"); @@ -76,46 +76,46 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Id") .ValueGeneratedOnAdd() .HasColumnName("id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("BoughtVouchersCount") .HasColumnName("bought_vouchers_count") - .HasColumnType("int"); + .HasColumnType("integer"); b.Property("CreatedBy") .IsRequired() .HasColumnName("created_by") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("CreationDate") .HasColumnName("creation_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("Currency") .IsRequired() .HasColumnName("currency") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("Description") .HasColumnName("description") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("ExpirationDate") .HasColumnName("expiration_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("FromDate") .HasColumnName("from_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("Name") .IsRequired() .HasColumnName("name") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("PartnerId") .HasColumnName("partner_id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("State") .HasColumnName("state") @@ -123,15 +123,15 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("ToDate") .HasColumnName("to_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("VoucherPrice") .HasColumnName("voucher_price") - .HasColumnType("decimal(18,2)"); + .HasColumnType("numeric"); b.Property("VouchersTotalCount") .HasColumnName("vouchers_total_count") - .HasColumnType("int"); + .HasColumnType("integer"); b.HasKey("Id"); @@ -144,31 +144,31 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnName("id") .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("CampaignId") .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("OwnerId") .HasColumnName("owner_id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("PurchaseDate") .HasColumnName("purchase_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("RedemptionDate") .HasColumnName("redemption_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("SellerId") .HasColumnName("seller_id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("ShortCode") .HasColumnName("short_code") - .HasColumnType("nvarchar(450)"); + .HasColumnType("text"); b.Property("Status") .HasColumnName("status") @@ -181,8 +181,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("OwnerId"); b.HasIndex("ShortCode") - .IsUnique() - .HasFilter("[short_code] IS NOT NULL"); + .IsUnique(); b.ToTable("voucher"); }); @@ -193,12 +192,12 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnName("id") .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ValidationCode") .IsRequired() .HasColumnName("validation_code") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("VoucherId") .HasColumnName("voucher_id") diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200406222041_InitialMigration.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200706074721_Initial.cs similarity index 80% rename from src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200406222041_InitialMigration.cs rename to src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200706074721_Initial.cs index 46476ba..4fb32e4 100644 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200406222041_InitialMigration.cs +++ b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/20200706074721_Initial.cs @@ -1,9 +1,10 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace MAVN.Service.SmartVouchers.MsSqlRepositories.Migrations { - public partial class InitialMigration : Migration + public partial class Initial : Migration { protected override void Up(MigrationBuilder migrationBuilder) { @@ -22,9 +23,10 @@ protected override void Up(MigrationBuilder migrationBuilder) bought_vouchers_count = table.Column(nullable: false), voucher_price = table.Column(nullable: false), currency = table.Column(nullable: false), - partner_id = table.Column(nullable: false), + partner_id = table.Column(nullable: false), from_date = table.Column(nullable: false), to_date = table.Column(nullable: true), + expiration_date = table.Column(nullable: true), creation_date = table.Column(nullable: false), created_by = table.Column(nullable: false), state = table.Column(nullable: false) @@ -34,18 +36,31 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("PK_campaign", x => x.id); }); + migrationBuilder.CreateTable( + name: "payment_request", + schema: "smart_vouchers", + columns: table => new + { + id = table.Column(nullable: false), + short_code = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_payment_request", x => x.id); + }); + migrationBuilder.CreateTable( name: "voucher", schema: "smart_vouchers", columns: table => new { id = table.Column(nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), short_code = table.Column(nullable: true), - validation_code_hash = table.Column(nullable: false), + seller_id = table.Column(nullable: true), campaign_id = table.Column(nullable: false), status = table.Column(nullable: false), - owner_id = table.Column(nullable: false), + owner_id = table.Column(nullable: true), purchase_date = table.Column(nullable: true), redemption_date = table.Column(nullable: true) }, @@ -83,7 +98,7 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { id = table.Column(nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), voucher_id = table.Column(nullable: false), validation_code = table.Column(nullable: false) }, @@ -105,6 +120,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "campaign_content", column: "campaign_id"); + migrationBuilder.CreateIndex( + name: "IX_payment_request_short_code", + schema: "smart_vouchers", + table: "payment_request", + column: "short_code"); + migrationBuilder.CreateIndex( name: "IX_voucher_campaign_id", schema: "smart_vouchers", @@ -122,8 +143,7 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "smart_vouchers", table: "voucher", column: "short_code", - unique: true, - filter: "[short_code] IS NOT NULL"); + unique: true); migrationBuilder.CreateIndex( name: "IX_voucher_validation_voucher_id", @@ -139,6 +159,10 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "campaign_content", schema: "smart_vouchers"); + migrationBuilder.DropTable( + name: "payment_request", + schema: "smart_vouchers"); + migrationBuilder.DropTable( name: "voucher_validation", schema: "smart_vouchers"); diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/SmartVouchersContextModelSnapshot.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/SmartVouchersContextModelSnapshot.cs index 9e1fed5..6ec6747 100644 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/SmartVouchersContextModelSnapshot.cs +++ b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Migrations/SmartVouchersContextModelSnapshot.cs @@ -3,8 +3,8 @@ using MAVN.Service.SmartVouchers.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.SmartVouchers.MsSqlRepositories.Migrations { @@ -16,21 +16,21 @@ protected override void BuildModel(ModelBuilder modelBuilder) #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("smart_vouchers") - .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.SmartVouchers.MsSqlRepositories.Entities.PaymentRequestEntity", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnName("id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("VoucherShortCode") .IsRequired() .HasColumnName("short_code") - .HasColumnType("nvarchar(450)"); + .HasColumnType("text"); b.HasKey("Id"); @@ -44,23 +44,23 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .ValueGeneratedOnAdd() .HasColumnName("id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CampaignId") .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("ContentType") .HasColumnName("content_type") - .HasColumnType("int"); + .HasColumnType("integer"); b.Property("Language") .HasColumnName("language") - .HasColumnType("int"); + .HasColumnType("integer"); b.Property("Value") .HasColumnName("value") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.HasKey("Id"); @@ -74,46 +74,46 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .ValueGeneratedOnAdd() .HasColumnName("id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("BoughtVouchersCount") .HasColumnName("bought_vouchers_count") - .HasColumnType("int"); + .HasColumnType("integer"); b.Property("CreatedBy") .IsRequired() .HasColumnName("created_by") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("CreationDate") .HasColumnName("creation_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("Currency") .IsRequired() .HasColumnName("currency") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("Description") .HasColumnName("description") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("ExpirationDate") .HasColumnName("expiration_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("FromDate") .HasColumnName("from_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("Name") .IsRequired() .HasColumnName("name") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("PartnerId") .HasColumnName("partner_id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("State") .HasColumnName("state") @@ -121,15 +121,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ToDate") .HasColumnName("to_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("VoucherPrice") .HasColumnName("voucher_price") - .HasColumnType("decimal(18,2)"); + .HasColumnType("numeric"); b.Property("VouchersTotalCount") .HasColumnName("vouchers_total_count") - .HasColumnType("int"); + .HasColumnType("integer"); b.HasKey("Id"); @@ -142,31 +142,31 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnName("id") .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("CampaignId") .HasColumnName("campaign_id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("OwnerId") .HasColumnName("owner_id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("PurchaseDate") .HasColumnName("purchase_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("RedemptionDate") .HasColumnName("redemption_date") - .HasColumnType("datetime2"); + .HasColumnType("timestamp without time zone"); b.Property("SellerId") .HasColumnName("seller_id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("ShortCode") .HasColumnName("short_code") - .HasColumnType("nvarchar(450)"); + .HasColumnType("text"); b.Property("Status") .HasColumnName("status") @@ -179,8 +179,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("OwnerId"); b.HasIndex("ShortCode") - .IsUnique() - .HasFilter("[short_code] IS NOT NULL"); + .IsUnique(); b.ToTable("voucher"); }); @@ -191,12 +190,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnName("id") .HasColumnType("bigint") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ValidationCode") .IsRequired() .HasColumnName("validation_code") - .HasColumnType("nvarchar(max)"); + .HasColumnType("text"); b.Property("VoucherId") .HasColumnName("voucher_id") diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/CampaignContentsRepository.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/CampaignContentsRepository.cs index d3c4b92..4bc5577 100644 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/CampaignContentsRepository.cs +++ b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/CampaignContentsRepository.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using AutoMapper; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.SmartVouchers.Domain.Models; using MAVN.Service.SmartVouchers.Domain.Repositories; using MAVN.Service.SmartVouchers.MsSqlRepositories.Entities; diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/CampaignsRepository.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/CampaignsRepository.cs index c9d0e48..8499d62 100644 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/CampaignsRepository.cs +++ b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/CampaignsRepository.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; using AutoMapper; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.SmartVouchers.Domain.Enums; using MAVN.Service.SmartVouchers.Domain.Models; using MAVN.Service.SmartVouchers.Domain.Repositories; diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/PaymentRequestsRepository.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/PaymentRequestsRepository.cs index 03b28c7..5b6f3eb 100644 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/PaymentRequestsRepository.cs +++ b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/PaymentRequestsRepository.cs @@ -1,6 +1,6 @@ using System; using System.Threading.Tasks; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.SmartVouchers.Domain.Repositories; using MAVN.Service.SmartVouchers.MsSqlRepositories.Entities; using Microsoft.EntityFrameworkCore; diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/VouchersRepository.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/VouchersRepository.cs index 38f5466..3501b43 100644 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/VouchersRepository.cs +++ b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/Repositories/VouchersRepository.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; using AutoMapper; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.SmartVouchers.Domain.Enums; using MAVN.Service.SmartVouchers.Domain.Models; using MAVN.Service.SmartVouchers.Domain.Repositories; diff --git a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/SmartVouchersContext.cs b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/SmartVouchersContext.cs index e114271..0e39d61 100644 --- a/src/MAVN.Service.SmartVouchers.MsSqlRepositories/SmartVouchersContext.cs +++ b/src/MAVN.Service.SmartVouchers.MsSqlRepositories/SmartVouchersContext.cs @@ -1,6 +1,6 @@ using System.Data.Common; using JetBrains.Annotations; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.SmartVouchers.MsSqlRepositories.Entities; using MAVN.Service.SmartVouchers.Domain.Enums; using Microsoft.EntityFrameworkCore; @@ -8,7 +8,7 @@ namespace MAVN.Service.SmartVouchers.MsSqlRepositories { - public class SmartVouchersContext : MsSqlContext + public class SmartVouchersContext : PostgreSQLContext { private const string Schema = "smart_vouchers"; @@ -41,7 +41,7 @@ public SmartVouchersContext(DbConnection dbConnection) { } - protected override void OnLykkeModelCreating(ModelBuilder modelBuilder) + protected override void OnMAVNModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .Property(o => o.State).HasConversion(new EnumToNumberConverter()); diff --git a/src/MAVN.Service.SmartVouchers/MAVN.Service.SmartVouchers.csproj b/src/MAVN.Service.SmartVouchers/MAVN.Service.SmartVouchers.csproj index 4acb34d..45ba4cd 100644 --- a/src/MAVN.Service.SmartVouchers/MAVN.Service.SmartVouchers.csproj +++ b/src/MAVN.Service.SmartVouchers/MAVN.Service.SmartVouchers.csproj @@ -26,6 +26,7 @@ + diff --git a/src/MAVN.Service.SmartVouchers/Modules/DbModule.cs b/src/MAVN.Service.SmartVouchers/Modules/DbModule.cs index 7f2e0f6..4ec8cb2 100644 --- a/src/MAVN.Service.SmartVouchers/Modules/DbModule.cs +++ b/src/MAVN.Service.SmartVouchers/Modules/DbModule.cs @@ -5,7 +5,7 @@ using JetBrains.Annotations; using Lykke.Common.Log; using Lykke.SettingsReader; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.SmartVouchers.AzureRepositories; using MAVN.Service.SmartVouchers.AzureRepositories.Entities; using MAVN.Service.SmartVouchers.Domain.Repositories; @@ -47,7 +47,7 @@ protected override void Load(ContainerBuilder builder) .As() .SingleInstance(); - builder.RegisterMsSql( + builder.RegisterPostgreSQL( _connectionString, connString => new SmartVouchersContext(connString, false), dbConn => new SmartVouchersContext(dbConn));