source: iknow-api/Migrations/20251027191028_dbRelations.cs@ ff202cf

Last change on this file since ff202cf was b38c39c, checked in by stefansaveski <stefansaveski19@…>, 11 months ago

Add user-related entities and enforce one-to-one mappings

Enhanced the User model with new entities: ContactInfo,
EnrollmentInfo, and HighSchool, establishing one-to-one
relationships. Updated UserDTO with additional fields and
introduced enums for type, quota, and major. Modified
UserRepository and AuthService to handle new entities.

Updated database schema with unique constraints on UserId
for related tables and added EF Core migration
20251027191028_dbRelations. Adjusted JSON serialization
to prevent circular references.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1using Microsoft.EntityFrameworkCore.Migrations;
2
3#nullable disable
4
5namespace iknow_api.Migrations
6{
7 /// <inheritdoc />
8 public partial class dbRelations : Migration
9 {
10 /// <inheritdoc />
11 protected override void Up(MigrationBuilder migrationBuilder)
12 {
13 migrationBuilder.DropIndex(
14 name: "IX_HighSchool_UserId",
15 table: "HighSchool");
16
17 migrationBuilder.DropIndex(
18 name: "IX_EnrollmentInfo_UserId",
19 table: "EnrollmentInfo");
20
21 migrationBuilder.DropIndex(
22 name: "IX_ContactInfo_UserId",
23 table: "ContactInfo");
24
25 migrationBuilder.CreateIndex(
26 name: "IX_HighSchool_UserId",
27 table: "HighSchool",
28 column: "UserId",
29 unique: true);
30
31 migrationBuilder.CreateIndex(
32 name: "IX_EnrollmentInfo_UserId",
33 table: "EnrollmentInfo",
34 column: "UserId",
35 unique: true);
36
37 migrationBuilder.CreateIndex(
38 name: "IX_ContactInfo_UserId",
39 table: "ContactInfo",
40 column: "UserId",
41 unique: true);
42 }
43
44 /// <inheritdoc />
45 protected override void Down(MigrationBuilder migrationBuilder)
46 {
47 migrationBuilder.DropIndex(
48 name: "IX_HighSchool_UserId",
49 table: "HighSchool");
50
51 migrationBuilder.DropIndex(
52 name: "IX_EnrollmentInfo_UserId",
53 table: "EnrollmentInfo");
54
55 migrationBuilder.DropIndex(
56 name: "IX_ContactInfo_UserId",
57 table: "ContactInfo");
58
59 migrationBuilder.CreateIndex(
60 name: "IX_HighSchool_UserId",
61 table: "HighSchool",
62 column: "UserId");
63
64 migrationBuilder.CreateIndex(
65 name: "IX_EnrollmentInfo_UserId",
66 table: "EnrollmentInfo",
67 column: "UserId");
68
69 migrationBuilder.CreateIndex(
70 name: "IX_ContactInfo_UserId",
71 table: "ContactInfo",
72 column: "UserId");
73 }
74 }
75}
Note: See TracBrowser for help on using the repository browser.