0
0
MyDarling/Migrations/20230603040054_Initial.cs

63 lines
2.2 KiB
C#
Raw Normal View History

2023-01-31 15:55:44 +03:00
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MyDarling.Migrations
{
/// <inheritdoc />
2023-06-03 07:41:46 +03:00
public partial class Initial : Migration
2023-01-31 15:55:44 +03:00
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
2023-06-03 07:41:46 +03:00
name: "Products",
2023-01-31 15:55:44 +03:00
columns: table => new
{
2023-06-03 07:41:46 +03:00
Id = table.Column<string>(type: "TEXT", nullable: false),
2023-01-31 15:55:44 +03:00
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Price = table.Column<decimal>(type: "TEXT", nullable: false)
},
constraints: table =>
{
2023-06-03 07:41:46 +03:00
table.PrimaryKey("PK_Products", x => x.Id);
2023-01-31 15:55:44 +03:00
});
migrationBuilder.CreateTable(
name: "Figures",
columns: table => new
{
2023-06-03 07:41:46 +03:00
Id = table.Column<string>(type: "TEXT", nullable: false),
2023-02-21 07:52:11 +03:00
Description = table.Column<string>(type: "TEXT", nullable: false),
2023-06-03 07:41:46 +03:00
ProductId = table.Column<string>(type: "TEXT", nullable: false)
2023-01-31 15:55:44 +03:00
},
constraints: table =>
{
table.PrimaryKey("PK_Figures", x => x.Id);
table.ForeignKey(
2023-06-03 07:41:46 +03:00
name: "FK_Figures_Products_ProductId",
column: x => x.ProductId,
principalTable: "Products",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
2023-01-31 15:55:44 +03:00
});
migrationBuilder.CreateIndex(
2023-06-03 07:41:46 +03:00
name: "IX_Figures_ProductId",
2023-01-31 15:55:44 +03:00
table: "Figures",
2023-06-03 07:41:46 +03:00
column: "ProductId");
2023-01-31 15:55:44 +03:00
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Figures");
migrationBuilder.DropTable(
2023-06-03 07:41:46 +03:00
name: "Products");
2023-01-31 15:55:44 +03:00
}
}
}