updTE DB PRO

This commit is contained in:
mmrbnjd
2024-07-25 13:50:22 +03:30
parent 4d4f424ff0
commit 466f26e986
4 changed files with 262 additions and 0 deletions

View File

@@ -47,6 +47,8 @@ namespace TaxPayer.Infrastructure.Persistence
public DbSet<stuff> Stuffs { get; set; }
public DbSet<Ulr> Ulrs { get; set; }
public DbSet<rptQueue> rptQueue { get; set; }
public DbSet<Promotion> Promotions { get; set; }
public DbSet<PromotionDetails> PromotionDetails { get; set; }
#endregion
//public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
//{

View File

@@ -0,0 +1,81 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("Satus")
.HasColumnType("bit");
b.HasKey("ID");
b.ToTable("Promotions");
});
modelBuilder.Entity("Back.Data.Models.PromotionDetails", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
b.Property<decimal>("APrice")
.HasColumnType("decimal(18,2)");
b.Property<int>("CreditAmount")
.HasColumnType("int");
b.Property<int>("PermissionID")
.HasColumnType("int");
b.Property<int>("PromotionID")
.HasColumnType("int");
b.HasKey("ID");
b.HasIndex("PermissionID");
b.HasIndex("PromotionID");
b.ToTable("PromotionDetails");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,100 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Back.Migrations
{
/// <inheritdoc />
public partial class Promotion : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Promotions",
columns: table => new
{
ID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Satus = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Promotions", x => x.ID);
});
migrationBuilder.CreateTable(
name: "PromotionDetails",
columns: table => new
{
ID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PromotionID = table.Column<int>(type: "int", nullable: false),
PermissionID = table.Column<int>(type: "int", nullable: false),
CreditAmount = table.Column<int>(type: "int", nullable: false),
APrice = table.Column<decimal>(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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PromotionDetails");
migrationBuilder.DropTable(
name: "Promotions");
}
}
}

View File

@@ -0,0 +1,79 @@
// <auto-generated />
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<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("Satus")
.HasColumnType("bit");
b.HasKey("ID");
b.ToTable("Promotions");
});
modelBuilder.Entity("Back.Data.Models.PromotionDetails", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
b.Property<decimal>("APrice")
.HasColumnType("decimal(18,2)");
b.Property<int>("CreditAmount")
.HasColumnType("int");
b.Property<int>("PermissionID")
.HasColumnType("int");
b.Property<int>("PromotionID")
.HasColumnType("int");
b.HasKey("ID");
b.HasIndex("PermissionID");
b.HasIndex("PromotionID");
b.ToTable("PromotionDetails");
});
#pragma warning restore 612, 618
}
}
}