68 lines
2.5 KiB
C#
68 lines
2.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace CompanyManagment.EFCore.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Addlawtable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Law",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Title = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
|
|
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
|
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Law", x => x.id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "LawItem",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Header = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
|
Details = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
OrderNumber = table.Column<int>(type: "int", nullable: false),
|
|
LawId = table.Column<long>(type: "bigint", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_LawItem", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_LawItem_Law_LawId",
|
|
column: x => x.LawId,
|
|
principalTable: "Law",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_LawItem_LawId",
|
|
table: "LawItem",
|
|
column: "LawId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "LawItem");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Law");
|
|
}
|
|
}
|
|
}
|