using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace UniversityDataBaseImplemet.Migrations
{
///
public partial class nullableEdStatusId4 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Documents_User_UserId",
table: "Documents");
migrationBuilder.DropPrimaryKey(
name: "PK_StudentStreams",
table: "StudentStreams");
migrationBuilder.DropIndex(
name: "IX_StudentStreams_StudentId",
table: "StudentStreams");
migrationBuilder.DropPrimaryKey(
name: "PK_StudentDocuments",
table: "StudentDocuments");
migrationBuilder.DropIndex(
name: "IX_StudentDocuments_StudentId",
table: "StudentDocuments");
migrationBuilder.DropPrimaryKey(
name: "PK_EducationGroupsStreams",
table: "EducationGroupsStreams");
migrationBuilder.DropIndex(
name: "IX_EducationGroupsStreams_EducationGroupId",
table: "EducationGroupsStreams");
migrationBuilder.DropPrimaryKey(
name: "PK_EducationGroupsDocuments",
table: "EducationGroupsDocuments");
migrationBuilder.DropIndex(
name: "IX_EducationGroupsDocuments_EducationGroupId",
table: "EducationGroupsDocuments");
migrationBuilder.AlterColumn(
name: "Id",
table: "StudentStreams",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AlterColumn(
name: "Id",
table: "StudentDocuments",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AlterColumn(
name: "Id",
table: "EducationGroupsStreams",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AlterColumn(
name: "Id",
table: "EducationGroupsDocuments",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddPrimaryKey(
name: "PK_StudentStreams",
table: "StudentStreams",
columns: new[] { "StudentId", "StreamId" });
migrationBuilder.AddPrimaryKey(
name: "PK_StudentDocuments",
table: "StudentDocuments",
columns: new[] { "StudentId", "DocumentId" });
migrationBuilder.AddPrimaryKey(
name: "PK_EducationGroupsStreams",
table: "EducationGroupsStreams",
columns: new[] { "EducationGroupId", "StreamId" });
migrationBuilder.AddPrimaryKey(
name: "PK_EducationGroupsDocuments",
table: "EducationGroupsDocuments",
columns: new[] { "EducationGroupId", "DocumentId" });
migrationBuilder.AddForeignKey(
name: "FK_Documents_User_UserId",
table: "Documents",
column: "UserId",
principalTable: "User",
principalColumn: "Id");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Documents_User_UserId",
table: "Documents");
migrationBuilder.DropPrimaryKey(
name: "PK_StudentStreams",
table: "StudentStreams");
migrationBuilder.DropPrimaryKey(
name: "PK_StudentDocuments",
table: "StudentDocuments");
migrationBuilder.DropPrimaryKey(
name: "PK_EducationGroupsStreams",
table: "EducationGroupsStreams");
migrationBuilder.DropPrimaryKey(
name: "PK_EducationGroupsDocuments",
table: "EducationGroupsDocuments");
migrationBuilder.AlterColumn(
name: "Id",
table: "StudentStreams",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AlterColumn(
name: "Id",
table: "StudentDocuments",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AlterColumn(
name: "Id",
table: "EducationGroupsStreams",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AlterColumn(
name: "Id",
table: "EducationGroupsDocuments",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddPrimaryKey(
name: "PK_StudentStreams",
table: "StudentStreams",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_StudentDocuments",
table: "StudentDocuments",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_EducationGroupsStreams",
table: "EducationGroupsStreams",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_EducationGroupsDocuments",
table: "EducationGroupsDocuments",
column: "Id");
migrationBuilder.CreateIndex(
name: "IX_StudentStreams_StudentId",
table: "StudentStreams",
column: "StudentId");
migrationBuilder.CreateIndex(
name: "IX_StudentDocuments_StudentId",
table: "StudentDocuments",
column: "StudentId");
migrationBuilder.CreateIndex(
name: "IX_EducationGroupsStreams_EducationGroupId",
table: "EducationGroupsStreams",
column: "EducationGroupId");
migrationBuilder.CreateIndex(
name: "IX_EducationGroupsDocuments_EducationGroupId",
table: "EducationGroupsDocuments",
column: "EducationGroupId");
migrationBuilder.AddForeignKey(
name: "FK_Documents_User_UserId",
table: "Documents",
column: "UserId",
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}