using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EkzamenDatabaseImplement.Migrations
{
///
public partial class Init : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Groups",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column(type: "nvarchar(max)", nullable: false),
Direction = table.Column(type: "nvarchar(max)", nullable: false),
Created = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Groups", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Students",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
fio = table.Column(type: "nvarchar(max)", nullable: false),
GroupId = table.Column(type: "int", nullable: false),
RecordBookId = table.Column(type: "int", nullable: false),
PassMark = table.Column(type: "int", nullable: false),
DateEnrollment = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Students", x => x.Id);
table.ForeignKey(
name: "FK_Students_Groups_GroupId",
column: x => x.GroupId,
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Students_GroupId",
table: "Students",
column: "GroupId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Students");
migrationBuilder.DropTable(
name: "Groups");
}
}
}