69 lines
2.6 KiB
C#
69 lines
2.6 KiB
C#
|
using System;
|
|||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace EkzamenDatabaseImplement.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class Init : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "Groups",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<int>(type: "int", nullable: false)
|
|||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|||
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|||
|
Direction = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|||
|
Created = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_Groups", x => x.Id);
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "Students",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<int>(type: "int", nullable: false)
|
|||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|||
|
fio = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|||
|
GroupId = table.Column<int>(type: "int", nullable: false),
|
|||
|
RecordBookId = table.Column<int>(type: "int", nullable: false),
|
|||
|
PassMark = table.Column<int>(type: "int", nullable: false),
|
|||
|
DateEnrollment = table.Column<DateTime>(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");
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "Students");
|
|||
|
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "Groups");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|