517 lines
23 KiB
C#
517 lines
23 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ProfessionalProfile.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class UwU : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "User",
|
|
columns: table => new
|
|
{
|
|
userId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
firstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
lastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
summary = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
dateOfBirth = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
darkTheme = table.Column<bool>(type: "bit", nullable: false),
|
|
address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
websiteURL = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
picture = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_User", x => x.userId);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "BusinessCard",
|
|
columns: table => new
|
|
{
|
|
bcId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
userId = table.Column<int>(type: "int", nullable: false),
|
|
summary = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
uniqueUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_BusinessCard", x => x.bcId);
|
|
table.ForeignKey(
|
|
name: "FK_BusinessCard_User_userId",
|
|
column: x => x.userId,
|
|
principalTable: "User",
|
|
principalColumn: "userId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Certificate",
|
|
columns: table => new
|
|
{
|
|
certificateId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
issuedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
issuedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
expirationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
userId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Certificate", x => x.certificateId);
|
|
table.ForeignKey(
|
|
name: "FK_Certificate_User_userId",
|
|
column: x => x.userId,
|
|
principalTable: "User",
|
|
principalColumn: "userId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Education",
|
|
columns: table => new
|
|
{
|
|
educationId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
userId = table.Column<int>(type: "int", nullable: false),
|
|
degree = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
institution = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
fieldOfStudy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
graduationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Education", x => x.educationId);
|
|
table.ForeignKey(
|
|
name: "FK_Education_User_userId",
|
|
column: x => x.userId,
|
|
principalTable: "User",
|
|
principalColumn: "userId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Notification",
|
|
columns: table => new
|
|
{
|
|
notificationId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
userId = table.Column<int>(type: "int", nullable: false),
|
|
activity = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
timestamp = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
details = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
isRead = table.Column<bool>(type: "bit", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Notification", x => x.notificationId);
|
|
table.ForeignKey(
|
|
name: "FK_Notification_User_userId",
|
|
column: x => x.userId,
|
|
principalTable: "User",
|
|
principalColumn: "userId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Privacy",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
userId = table.Column<int>(type: "int", nullable: false),
|
|
CanViewEducation = table.Column<bool>(type: "bit", nullable: false),
|
|
CanViewWorkExperience = table.Column<bool>(type: "bit", nullable: false),
|
|
CanViewSkills = table.Column<bool>(type: "bit", nullable: false),
|
|
CanViewProjects = table.Column<bool>(type: "bit", nullable: false),
|
|
CanViewCertificates = table.Column<bool>(type: "bit", nullable: false),
|
|
CanViewVolunteering = table.Column<bool>(type: "bit", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Privacy", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Privacy_User_userId",
|
|
column: x => x.userId,
|
|
principalTable: "User",
|
|
principalColumn: "userId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Project",
|
|
columns: table => new
|
|
{
|
|
projectId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
projectName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
technologies = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
userId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Project", x => x.projectId);
|
|
table.ForeignKey(
|
|
name: "FK_Project_User_userId",
|
|
column: x => x.userId,
|
|
principalTable: "User",
|
|
principalColumn: "userId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Volunteering",
|
|
columns: table => new
|
|
{
|
|
volunteeringId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
userId = table.Column<int>(type: "int", nullable: false),
|
|
organisation = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
role = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
description = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Volunteering", x => x.volunteeringId);
|
|
table.ForeignKey(
|
|
name: "FK_Volunteering_User_userId",
|
|
column: x => x.userId,
|
|
principalTable: "User",
|
|
principalColumn: "userId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "WorkExperience",
|
|
columns: table => new
|
|
{
|
|
workId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
userId = table.Column<int>(type: "int", nullable: false),
|
|
jobTitle = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
company = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
location = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
employmentPeriod = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
responsibilities = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
achievements = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
description = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_WorkExperience", x => x.workId);
|
|
table.ForeignKey(
|
|
name: "FK_WorkExperience_User_userId",
|
|
column: x => x.userId,
|
|
principalTable: "User",
|
|
principalColumn: "userId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Skill",
|
|
columns: table => new
|
|
{
|
|
skillId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
BusinessCardbcId = table.Column<int>(type: "int", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Skill", x => x.skillId);
|
|
table.ForeignKey(
|
|
name: "FK_Skill_BusinessCard_BusinessCardbcId",
|
|
column: x => x.BusinessCardbcId,
|
|
principalTable: "BusinessCard",
|
|
principalColumn: "bcId");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AssessmentTest",
|
|
columns: table => new
|
|
{
|
|
assessmentTestId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
testName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
userId = table.Column<int>(type: "int", nullable: false),
|
|
description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
skillid = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AssessmentTest", x => x.assessmentTestId);
|
|
table.ForeignKey(
|
|
name: "FK_AssessmentTest_Skill_skillid",
|
|
column: x => x.skillid,
|
|
principalTable: "Skill",
|
|
principalColumn: "skillId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_AssessmentTest_User_userId",
|
|
column: x => x.userId,
|
|
principalTable: "User",
|
|
principalColumn: "userId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Endorsement",
|
|
columns: table => new
|
|
{
|
|
endorsementId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
endorserId = table.Column<int>(type: "int", nullable: false),
|
|
recipientid = table.Column<int>(type: "int", nullable: false),
|
|
skillId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Endorsement", x => x.endorsementId);
|
|
table.ForeignKey(
|
|
name: "FK_Endorsement_Skill_skillId",
|
|
column: x => x.skillId,
|
|
principalTable: "Skill",
|
|
principalColumn: "skillId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Endorsement_User_endorserId",
|
|
column: x => x.endorserId,
|
|
principalTable: "User",
|
|
principalColumn: "userId",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_Endorsement_User_recipientid",
|
|
column: x => x.recipientid,
|
|
principalTable: "User",
|
|
principalColumn: "userId",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AssessmentResult",
|
|
columns: table => new
|
|
{
|
|
assesmentResultId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
assesmentTestId = table.Column<int>(type: "int", nullable: false),
|
|
score = table.Column<int>(type: "int", nullable: false),
|
|
userId = table.Column<int>(type: "int", nullable: false),
|
|
testDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AssessmentResult", x => x.assesmentResultId);
|
|
table.ForeignKey(
|
|
name: "FK_AssessmentResult_AssessmentTest_assesmentTestId",
|
|
column: x => x.assesmentTestId,
|
|
principalTable: "AssessmentTest",
|
|
principalColumn: "assessmentTestId");
|
|
table.ForeignKey(
|
|
name: "FK_AssessmentResult_User_userId",
|
|
column: x => x.userId,
|
|
principalTable: "User",
|
|
principalColumn: "userId");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Question",
|
|
columns: table => new
|
|
{
|
|
questionId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
questionText = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
assesmentTestId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Question", x => x.questionId);
|
|
table.ForeignKey(
|
|
name: "FK_Question_AssessmentTest_assesmentTestId",
|
|
column: x => x.assesmentTestId,
|
|
principalTable: "AssessmentTest",
|
|
principalColumn: "assessmentTestId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Answers",
|
|
columns: table => new
|
|
{
|
|
answerId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
answerText = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
questionId = table.Column<int>(type: "int", nullable: false),
|
|
isCorrect = table.Column<bool>(type: "bit", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Answers", x => x.answerId);
|
|
table.ForeignKey(
|
|
name: "FK_Answers_Question_questionId",
|
|
column: x => x.questionId,
|
|
principalTable: "Question",
|
|
principalColumn: "questionId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Answers_questionId",
|
|
table: "Answers",
|
|
column: "questionId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AssessmentResult_assesmentTestId",
|
|
table: "AssessmentResult",
|
|
column: "assesmentTestId",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AssessmentResult_userId",
|
|
table: "AssessmentResult",
|
|
column: "userId",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AssessmentTest_skillid",
|
|
table: "AssessmentTest",
|
|
column: "skillid");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AssessmentTest_userId",
|
|
table: "AssessmentTest",
|
|
column: "userId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_BusinessCard_userId",
|
|
table: "BusinessCard",
|
|
column: "userId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Certificate_userId",
|
|
table: "Certificate",
|
|
column: "userId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Education_userId",
|
|
table: "Education",
|
|
column: "userId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Endorsement_endorserId",
|
|
table: "Endorsement",
|
|
column: "endorserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Endorsement_recipientid",
|
|
table: "Endorsement",
|
|
column: "recipientid");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Endorsement_skillId",
|
|
table: "Endorsement",
|
|
column: "skillId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notification_userId",
|
|
table: "Notification",
|
|
column: "userId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Privacy_userId",
|
|
table: "Privacy",
|
|
column: "userId",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Project_userId",
|
|
table: "Project",
|
|
column: "userId",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Question_assesmentTestId",
|
|
table: "Question",
|
|
column: "assesmentTestId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Skill_BusinessCardbcId",
|
|
table: "Skill",
|
|
column: "BusinessCardbcId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Volunteering_userId",
|
|
table: "Volunteering",
|
|
column: "userId",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkExperience_userId",
|
|
table: "WorkExperience",
|
|
column: "userId",
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Answers");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AssessmentResult");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Certificate");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Education");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Endorsement");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Notification");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Privacy");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Project");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Volunteering");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "WorkExperience");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Question");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AssessmentTest");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Skill");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "BusinessCard");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "User");
|
|
}
|
|
}
|
|
}
|