From 466f26e98615a50afd72de143ba484e730f30065 Mon Sep 17 00:00:00 2001 From: mmrbnjd Date: Thu, 25 Jul 2024 13:50:22 +0330 Subject: [PATCH] updTE DB PRO --- .../Persistence/SqlDbContext.cs | 2 + .../20240725100322_Promotion.Designer.cs | 81 ++++++++++++++ Back/Migrations/20240725100322_Promotion.cs | 100 ++++++++++++++++++ Back/Migrations/SqlDbContextModelSnapshot.cs | 79 ++++++++++++++ 4 files changed, 262 insertions(+) create mode 100644 Back/Migrations/20240725100322_Promotion.Designer.cs create mode 100644 Back/Migrations/20240725100322_Promotion.cs create mode 100644 Back/Migrations/SqlDbContextModelSnapshot.cs diff --git a/Back/Data/Infrastructure/Persistence/SqlDbContext.cs b/Back/Data/Infrastructure/Persistence/SqlDbContext.cs index 177be6b..ebc37fc 100644 --- a/Back/Data/Infrastructure/Persistence/SqlDbContext.cs +++ b/Back/Data/Infrastructure/Persistence/SqlDbContext.cs @@ -47,6 +47,8 @@ namespace TaxPayer.Infrastructure.Persistence public DbSet Stuffs { get; set; } public DbSet Ulrs { get; set; } public DbSet rptQueue { get; set; } + public DbSet Promotions { get; set; } + public DbSet PromotionDetails { get; set; } #endregion //public override Task SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken()) //{ diff --git a/Back/Migrations/20240725100322_Promotion.Designer.cs b/Back/Migrations/20240725100322_Promotion.Designer.cs new file mode 100644 index 0000000..65473b0 --- /dev/null +++ b/Back/Migrations/20240725100322_Promotion.Designer.cs @@ -0,0 +1,81 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using TaxPayer.Infrastructure.Persistence; + +#nullable disable + +namespace Back.Migrations +{ + [DbContext(typeof(SqlDbContext))] + [Migration("20240725100322_Promotion")] + partial class Promotion + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.15") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + + modelBuilder.Entity("Back.Data.Models.Promotion", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Satus") + .HasColumnType("bit"); + + b.HasKey("ID"); + + b.ToTable("Promotions"); + }); + + modelBuilder.Entity("Back.Data.Models.PromotionDetails", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("APrice") + .HasColumnType("decimal(18,2)"); + + b.Property("CreditAmount") + .HasColumnType("int"); + + b.Property("PermissionID") + .HasColumnType("int"); + + b.Property("PromotionID") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.HasIndex("PermissionID"); + + b.HasIndex("PromotionID"); + + b.ToTable("PromotionDetails"); + }); + + #pragma warning restore 612, 618 + } + } +} diff --git a/Back/Migrations/20240725100322_Promotion.cs b/Back/Migrations/20240725100322_Promotion.cs new file mode 100644 index 0000000..a06224a --- /dev/null +++ b/Back/Migrations/20240725100322_Promotion.cs @@ -0,0 +1,100 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Back.Migrations +{ + /// + public partial class Promotion : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + + + + + migrationBuilder.CreateTable( + name: "Promotions", + columns: table => new + { + ID = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false), + Satus = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Promotions", x => x.ID); + }); + + + + + migrationBuilder.CreateTable( + name: "PromotionDetails", + columns: table => new + { + ID = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PromotionID = table.Column(type: "int", nullable: false), + PermissionID = table.Column(type: "int", nullable: false), + CreditAmount = table.Column(type: "int", nullable: false), + APrice = table.Column(type: "decimal(18,2)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PromotionDetails", x => x.ID); + table.ForeignKey( + name: "FK_PromotionDetails_Permissions_PermissionID", + column: x => x.PermissionID, + principalTable: "Permissions", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PromotionDetails_Promotions_PromotionID", + column: x => x.PromotionID, + principalTable: "Promotions", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + + + + + + + + + + + migrationBuilder.CreateIndex( + name: "IX_PromotionDetails_PermissionID", + table: "PromotionDetails", + column: "PermissionID"); + + migrationBuilder.CreateIndex( + name: "IX_PromotionDetails_PromotionID", + table: "PromotionDetails", + column: "PromotionID"); + + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + migrationBuilder.DropTable( + name: "PromotionDetails"); + + + migrationBuilder.DropTable( + name: "Promotions"); + + + } + } +} diff --git a/Back/Migrations/SqlDbContextModelSnapshot.cs b/Back/Migrations/SqlDbContextModelSnapshot.cs new file mode 100644 index 0000000..901221f --- /dev/null +++ b/Back/Migrations/SqlDbContextModelSnapshot.cs @@ -0,0 +1,79 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using TaxPayer.Infrastructure.Persistence; + +#nullable disable + +namespace Back.Migrations +{ + [DbContext(typeof(SqlDbContext))] + partial class SqlDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.15") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + + modelBuilder.Entity("Back.Data.Models.Promotion", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Satus") + .HasColumnType("bit"); + + b.HasKey("ID"); + + b.ToTable("Promotions"); + }); + + modelBuilder.Entity("Back.Data.Models.PromotionDetails", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("APrice") + .HasColumnType("decimal(18,2)"); + + b.Property("CreditAmount") + .HasColumnType("int"); + + b.Property("PermissionID") + .HasColumnType("int"); + + b.Property("PromotionID") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.HasIndex("PermissionID"); + + b.HasIndex("PromotionID"); + + b.ToTable("PromotionDetails"); + }); + + +#pragma warning restore 612, 618 + } + } +}