Ignore:
Timestamp:
12/16/25 23:05:19 (9 months ago)
Author:
Stefan-Saveski <stefansaveski19@…>
Branches:
master
Children:
bb02e3a
Parents:
61fd94e
Message:

Upgraded database, added get subjects and get passed subjects.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • iknow-api/Migrations/20251216191800_InitialCreate.cs

    r61fd94e raee2b88  
    1010{
    1111    /// <inheritdoc />
    12     public partial class inital : Migration
     12    public partial class InitialCreate : Migration
    1313    {
    1414        /// <inheritdoc />
     
    1919                columns: table => new
    2020                {
    21                     id = table.Column<int>(type: "integer", nullable: false)
    22                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    23                     year = table.Column<int>(type: "integer", nullable: false),
     21                    Id = table.Column<int>(type: "integer", nullable: false)
     22                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
     23                    Year = table.Column<int>(type: "integer", nullable: false),
    2424                    Type = table.Column<int>(type: "integer", nullable: false)
    2525                },
    2626                constraints: table =>
    2727                {
    28                     table.PrimaryKey("PK_ActiveSemesters", x => x.id);
     28                    table.PrimaryKey("PK_ActiveSemesters", x => x.Id);
    2929                });
    3030
     
    181181                    MajorId = table.Column<int>(type: "integer", nullable: false),
    182182                    StudentComment = table.Column<string>(type: "text", nullable: true),
    183                     Node = table.Column<string>(type: "text", nullable: true),
     183                    Note = table.Column<string>(type: "text", nullable: true),
    184184                    CratedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
    185185                    LastChange = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
    186                     Veryfied = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
     186                    Verified = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
     187                    SemesterId = table.Column<int>(type: "integer", nullable: false)
    187188                },
    188189                constraints: table =>
     
    193194                        column: x => x.Id,
    194195                        principalTable: "ActiveSemesters",
    195                         principalColumn: "id",
     196                        principalColumn: "Id",
    196197                        onDelete: ReferentialAction.Restrict);
    197198                    table.ForeignKey(
     
    215216                    Id = table.Column<int>(type: "integer", nullable: false)
    216217                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    217                     enrollmentYear = table.Column<int>(type: "integer", nullable: false),
    218                     quota = table.Column<int>(type: "integer", nullable: false),
     218                    EnrollmentYear = table.Column<int>(type: "integer", nullable: false),
     219                    Quota = table.Column<int>(type: "integer", nullable: false),
    219220                    MajorId = table.Column<int>(type: "integer", nullable: false),
    220221                    UserId = table.Column<int>(type: "integer", nullable: false),
     
    256257                        name: "FK_HighSchool_User_UserId",
    257258                        column: x => x.UserId,
     259                        principalTable: "User",
     260                        principalColumn: "Id",
     261                        onDelete: ReferentialAction.Cascade);
     262                });
     263
     264            migrationBuilder.CreateTable(
     265                name: "ProfessorSubjects",
     266                columns: table => new
     267                {
     268                    ProfessorId = table.Column<int>(type: "integer", nullable: false),
     269                    SemesterId = table.Column<int>(type: "integer", nullable: false),
     270                    SubjectId = table.Column<int>(type: "integer", nullable: false)
     271                },
     272                constraints: table =>
     273                {
     274                    table.PrimaryKey("PK_ProfessorSubjects", x => new { x.ProfessorId, x.SemesterId, x.SubjectId });
     275                    table.ForeignKey(
     276                        name: "FK_ProfessorSubjects_ActiveSemesters_SemesterId",
     277                        column: x => x.SemesterId,
     278                        principalTable: "ActiveSemesters",
     279                        principalColumn: "Id",
     280                        onDelete: ReferentialAction.Cascade);
     281                    table.ForeignKey(
     282                        name: "FK_ProfessorSubjects_Subjects_SubjectId",
     283                        column: x => x.SubjectId,
     284                        principalTable: "Subjects",
     285                        principalColumn: "Id",
     286                        onDelete: ReferentialAction.Cascade);
     287                    table.ForeignKey(
     288                        name: "FK_ProfessorSubjects_User_ProfessorId",
     289                        column: x => x.ProfessorId,
    258290                        principalTable: "User",
    259291                        principalColumn: "Id",
     
    466498
    467499            migrationBuilder.CreateIndex(
     500                name: "IX_ProfessorSubjects_SemesterId",
     501                table: "ProfessorSubjects",
     502                column: "SemesterId");
     503
     504            migrationBuilder.CreateIndex(
     505                name: "IX_ProfessorSubjects_SubjectId",
     506                table: "ProfessorSubjects",
     507                column: "SubjectId");
     508
     509            migrationBuilder.CreateIndex(
    468510                name: "IX_RefreshToken_UserId",
    469511                table: "RefreshToken",
     
    521563
    522564            migrationBuilder.DropTable(
     565                name: "ProfessorSubjects");
     566
     567            migrationBuilder.DropTable(
    523568                name: "RefreshToken");
    524569
Note: See TracChangeset for help on using the changeset viewer.