using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WpfAppUI.Migrations
{
///
public partial class initial : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Posts",
columns: table => new
{
id = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Posts", x => x.id);
});
migrationBuilder.CreateTable(
name: "Emploees",
columns: table => new
{
id = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Surname = table.Column(type: "nvarchar(max)", nullable: false),
Name = table.Column(type: "nvarchar(max)", nullable: false),
Patronymic = table.Column(type: "nvarchar(max)", nullable: true),
PostId = table.Column(type: "int", nullable: false),
Birthday = table.Column(type: "date", nullable: false),
Phone = table.Column(type: "nvarchar(max)", nullable: false),
Mail = table.Column(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Emploees", x => x.id);
table.ForeignKey(
name: "FK_Emploees_Posts_PostId",
column: x => x.PostId,
principalTable: "Posts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Emploees_PostId",
table: "Emploees",
column: "PostId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Emploees");
migrationBuilder.DropTable(
name: "Posts");
}
}
}