✨ Add BrandId columns and update project framework
* ✨ Introduce `EditDisc` migration in `NetinaShop.Repository.Migrations` * 🗃️ Add `BrandId` column to `OrderProducts` and `Discounts` tables * 🛠️ Set default value for `BrandId` in `OrderProducts` to `00000000-0000-0000-0000-000000000000` * 🗃️ Make `BrandId` in `Discounts` nullable * 🏷️ Create index on `BrandId` in `Discounts` table * 🔗 Add foreign key constraint from `Discounts` to `Brands` on `BrandId` * 🔄 Implement `Down` method to reverse migration changes * ⬆️ Update target framework to `net8.0` * 🔢 Increment `AssemblyVersion` and `FileVersion` in `Netina.Api.csproj` * 🏷️ Add `BrandId` and `Count` properties to `ApplicationContextModelSnapshot.cs` * 🆕 Add `BrandDiscount` entity inheriting from `Discount` with `BrandId` property Changes made by Amir.h Khademimaster
parent
e445be641e
commit
1d29f39cbc
|
@ -6,8 +6,8 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<AssemblyVersion>1.10.21.36</AssemblyVersion>
|
||||
<FileVersion>1.10.21.36</FileVersion>
|
||||
<AssemblyVersion>1.10.22.37</AssemblyVersion>
|
||||
<FileVersion>1.10.22.37</FileVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NetinaShop.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class EditDisc : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "BrandId",
|
||||
schema: "public",
|
||||
table: "OrderProducts",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Discounts_BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts",
|
||||
column: "BrandId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Discounts_Brands_BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts",
|
||||
column: "BrandId",
|
||||
principalSchema: "public",
|
||||
principalTable: "Brands",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Discounts_Brands_BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Discounts_BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BrandId",
|
||||
schema: "public",
|
||||
table: "OrderProducts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -743,6 +743,9 @@ namespace NetinaShop.Repository.Migrations
|
|||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("BrandId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
|
@ -1674,6 +1677,18 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasDiscriminator().HasValue("ProductComment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Discounts.BrandDiscount", b =>
|
||||
{
|
||||
b.HasBaseType("Netina.Domain.Entities.Discounts.Discount");
|
||||
|
||||
b.Property<Guid>("BrandId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasIndex("BrandId");
|
||||
|
||||
b.HasDiscriminator().HasValue("BrandDiscount");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b =>
|
||||
{
|
||||
b.HasBaseType("Netina.Domain.Entities.Discounts.Discount");
|
||||
|
@ -2111,6 +2126,16 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Discounts.BrandDiscount", b =>
|
||||
{
|
||||
b.HasOne("Netina.Domain.Entities.Brands.Brand", "Brand")
|
||||
.WithMany()
|
||||
.HasForeignKey("BrandId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Brand");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b =>
|
||||
{
|
||||
b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category")
|
||||
|
|
Loading…
Reference in New Issue