· 6 years ago · Dec 02, 2019, 08:50 AM
1// <auto-generated />
2using System;
3using Api;
4using Microsoft.EntityFrameworkCore;
5using Microsoft.EntityFrameworkCore.Infrastructure;
6using Microsoft.EntityFrameworkCore.Migrations;
7using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
8
9namespace Api.Migrations
10{
11 [DbContext(typeof(SandboxDbContext))]
12 [Migration("20191120073214_Initialcreation")]
13 partial class Initialcreation
14 {
15 protected override void BuildTargetModel(ModelBuilder modelBuilder)
16 {
17#pragma warning disable 612, 618
18 modelBuilder
19 .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
20 .HasAnnotation("Relational:MaxIdentifierLength", 64);
21
22 modelBuilder.Entity("Api.Models.Award", b =>
23 {
24 b.Property<int>("AwardID")
25 .ValueGeneratedOnAdd();
26
27 b.Property<DateTime>("DateOfAward");
28
29 b.Property<string>("Description")
30 .HasMaxLength(500);
31
32 b.Property<string>("Name")
33 .IsRequired();
34
35 b.HasKey("AwardID");
36
37 b.ToTable("Awards");
38
39 b.HasData(
40 new { AwardID = 1, DateOfAward = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Description = "Top 10% of the cohort", Name = "Director's List 1.1" },
41 new { AwardID = 2, DateOfAward = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Description = "Top 10% of the cohort", Name = "Director's List 1.2" },
42 new { AwardID = 3, DateOfAward = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Description = "Top 10% of the cohort", Name = "Director's List 2.1" },
43 new { AwardID = 4, DateOfAward = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Description = "Top 10% of the cohort", Name = "Director's List 2.2" },
44 new { AwardID = 5, DateOfAward = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Description = "Top 10% of the cohort", Name = "Director's List 3.1" },
45 new { AwardID = 6, DateOfAward = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Description = "Top 10% of the cohort", Name = "Director's List 3.2" }
46 );
47 });
48
49 modelBuilder.Entity("Api.Models.Building", b =>
50 {
51 b.Property<int>("BuildingID")
52 .ValueGeneratedOnAdd();
53
54 b.Property<string>("Description")
55 .IsRequired();
56
57 b.Property<string>("Name")
58 .IsRequired();
59
60 b.HasKey("BuildingID");
61
62 b.ToTable("Buildings");
63
64 b.HasData(
65 new { BuildingID = 1, Description = "The block 22 in NP.", Name = "Block 22" }
66 );
67 });
68
69 modelBuilder.Entity("Api.Models.Canteen", b =>
70 {
71 b.Property<int>("CanteenID")
72 .ValueGeneratedOnAdd();
73
74 b.Property<int?>("BuildingID");
75
76 b.Property<string>("Description")
77 .HasMaxLength(500);
78
79 b.Property<string>("Name")
80 .IsRequired();
81
82 b.HasKey("CanteenID");
83
84 b.HasIndex("BuildingID")
85 .IsUnique();
86
87 b.ToTable("Canteens");
88
89 b.HasData(
90 new { CanteenID = 1, BuildingID = 1, Description = "Located at block 22", Name = "Food Club" }
91 );
92 });
93
94 modelBuilder.Entity("Api.Models.Cca", b =>
95 {
96 b.Property<int>("CcaID")
97 .ValueGeneratedOnAdd();
98
99 b.Property<string>("Description")
100 .IsRequired()
101 .HasMaxLength(500);
102
103 b.Property<string>("Name")
104 .IsRequired();
105
106 b.Property<int?>("StudentID");
107
108 b.HasKey("CcaID");
109
110 b.HasIndex("StudentID");
111
112 b.ToTable("Ccas");
113 });
114
115 modelBuilder.Entity("Api.Models.Course", b =>
116 {
117 b.Property<int>("CourseID")
118 .ValueGeneratedOnAdd();
119
120 b.Property<string>("Description")
121 .IsRequired();
122
123 b.Property<string>("Name")
124 .IsRequired();
125
126 b.HasKey("CourseID");
127
128 b.ToTable("Courses");
129
130 b.HasData(
131 new { CourseID = 1, Description = "Where the world of Information Technology comes to life", Name = "Information Technology" },
132 new { CourseID = 2, Description = "Where the world of Information Technology comes to life", Name = "Immersive Media" },
133 new { CourseID = 3, Description = "Where the world of Information Technology comes to life", Name = "Common ICT Programme" },
134 new { CourseID = 4, Description = "Where the world of Information Technology comes to life", Name = "Cybersecurity & Digital Forensics" },
135 new { CourseID = 5, Description = "Where the world of Information Technology comes to life", Name = "Financial Information" },
136 new { CourseID = 6, Description = "Focus on game & interactive media design and programming", Name = "IMGD" }
137 );
138 });
139
140 modelBuilder.Entity("Api.Models.Event", b =>
141 {
142 b.Property<int>("EventID")
143 .ValueGeneratedOnAdd();
144
145 b.Property<string>("Description")
146 .IsRequired();
147
148 b.Property<DateTime>("EndDate");
149
150 b.Property<string>("Name")
151 .IsRequired();
152
153 b.Property<int>("NumStudents");
154
155 b.Property<DateTime>("StartDate");
156
157 b.Property<int?>("StudentID");
158
159 b.Property<int>("Time");
160
161 b.HasKey("EventID");
162
163 b.HasIndex("StudentID");
164
165 b.ToTable("Events");
166
167 b.HasData(
168 new { EventID = 1, Description = "Bringing food to the less needy", EndDate = new DateTime(2019, 11, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Name = "Food for the Heart", NumStudents = 50, StartDate = new DateTime(2019, 11, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), Time = 1400 },
169 new { EventID = 2, Description = "Yearly event allowing students to donate blood", EndDate = new DateTime(2019, 9, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), Name = "Blood donation drive", NumStudents = 200, StartDate = new DateTime(2019, 9, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Time = 1400 },
170 new { EventID = 3, Description = "A compulsory hackathon organised by school of ICT for the P2 module!", EndDate = new DateTime(2019, 9, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), Name = "NP ICT Byte Hackathon", NumStudents = 140, StartDate = new DateTime(2019, 9, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Time = 1400 }
171 );
172 });
173
174 modelBuilder.Entity("Api.Models.Faction", b =>
175 {
176 b.Property<int>("FactionID")
177 .ValueGeneratedOnAdd();
178
179 b.Property<string>("Description");
180
181 b.Property<string>("Name");
182
183 b.HasKey("FactionID");
184
185 b.ToTable("Factions");
186
187 b.HasData(
188 new { FactionID = 1, Description = "The Commando faction houses the students who were initially grouped in the commando faction", Name = "Commando" },
189 new { FactionID = 2, Description = "The Vanguard faction houses the students", Name = "Vanguard" }
190 );
191 });
192
193 modelBuilder.Entity("Api.Models.Event", b =>
194 {
195 b.Property<int>("EventID")
196 .ValueGeneratedOnAdd();
197
198 b.Property<string>("Description")
199 .IsRequired();
200
201 b.Property<string>("Name")
202 .IsRequired();
203
204 b.Property<int>("NumStudents");
205
206 b.HasKey("EventID");
207
208 b.ToTable("Events");
209
210 b.HasData(
211 new { EventID = 1, Description = "Bringing food to the less needy", Name = "Food for the Heart", NumStudents = 50 },
212 new { EventID = 2, Description = "Yearly event allowing students to donate blood", Name = "Blood donation drive", NumStudents = 200 }
213 );
214 });
215
216 modelBuilder.Entity("Api.Models.Faction", b =>
217 {
218 b.Property<int>("FactionID")
219 .ValueGeneratedOnAdd();
220
221 b.Property<string>("Description");
222
223 b.Property<string>("Name")
224 .IsRequired();
225
226 b.HasKey("FactionID");
227
228 b.ToTable("Factions");
229
230 b.HasData(
231 new { FactionID = 1, Description = "The Commando faction houses the students who were initially grouped in the commando faction", Name = "Commando" },
232 new { FactionID = 2, Description = "The Vanguard faction houses the students", Name = "Vanguard" }
233 );
234 });
235
236 modelBuilder.Entity("Api.Models.FoodItem", b =>
237 {
238 b.Property<int>("FoodItemID")
239 .ValueGeneratedOnAdd();
240
241 b.Property<int>("Calorie");
242
243 b.Property<string>("Name");
244
245 b.Property<float>("Price");
246
247 b.Property<int?>("StoreID");
248
249 b.Property<string>("Type");
250
251 b.HasKey("FoodItemID");
252
253 b.HasIndex("StoreID");
254
255 b.ToTable("FoodItems");
256 });
257
258 modelBuilder.Entity("Api.Models.MedicalCertificate", b =>
259 {
260 b.Property<int>("MedicalCertificateID")
261 .ValueGeneratedOnAdd();
262
263 b.Property<DateTime>("EndDate");
264
265 b.Property<int?>("MentorID");
266
267 b.Property<DateTime>("StartDate");
268
269 b.Property<bool>("Status");
270
271 b.Property<int?>("StudentID");
272
273 b.HasKey("MedicalCertificateID");
274
275 b.HasIndex("MentorID");
276
277 b.HasIndex("StudentID");
278
279 b.ToTable("MedicalCertificates");
280
281 b.HasData(
282 new { MedicalCertificateID = 1, EndDate = new DateTime(2019, 9, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), MentorID = 1, StartDate = new DateTime(2019, 9, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Status = true },
283 new { MedicalCertificateID = 2, EndDate = new DateTime(2019, 9, 4, 0, 0, 0, 0, DateTimeKind.Unspecified), StartDate = new DateTime(2019, 9, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), Status = true, StudentID = 1 }
284 );
285 });
286
287 modelBuilder.Entity("Api.Models.Mentor", b =>
288 {
289 b.Property<int>("MentorID")
290 .ValueGeneratedOnAdd();
291
292 b.Property<string>("Email")
293 .IsRequired();
294
295 b.Property<DateTime>("JoinDate");
296
297 b.Property<int>("MentorGroupID");
298
299 b.Property<string>("Name")
300 .IsRequired();
301
302 b.Property<string>("Status")
303 .IsRequired();
304
305 b.HasKey("MentorID");
306
307 b.HasIndex("MentorGroupID")
308 .IsUnique();
309
310 b.ToTable("Mentors");
311
312 b.HasData(
313 new { MentorID = 1, Email = "drjoel@yang@np.edu.sg", JoinDate = new DateTime(2019, 9, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), MentorGroupID = 1, Name = "Dr Joel Yang", Status = "FTStaff" },
314 new { MentorID = 2, Email = "wsly2@np.edu.sg", JoinDate = new DateTime(2015, 8, 2, 0, 0, 0, 0, DateTimeKind.Unspecified), MentorGroupID = 2, Name = "Dr Wesley Teo", Status = "FTStaff" },
315 new { MentorID = 3, Email = "oonwc@np.edu.sg", JoinDate = new DateTime(2009, 4, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), MentorGroupID = 3, Name = "Dr Oon", Status = "FTStaff" }
316 );
317 });
318
319 modelBuilder.Entity("Api.Models.MentorGroup", b =>
320 {
321 b.Property<int>("MentorGroupID")
322 .ValueGeneratedOnAdd();
323
324 b.Property<string>("Code");
325
326 b.Property<int>("MentorID");
327
328 b.HasKey("MentorGroupID");
329
330 b.ToTable("MentorGroups");
331
332 b.HasData(
333 new { MentorGroupID = 1, Code = "1707", MentorID = 1 },
334 new { MentorGroupID = 2, Code = "1706", MentorID = 2 },
335 new { MentorGroupID = 3, Code = "1705", MentorID = 3 },
336 new { MentorGroupID = 4, Code = "1704", MentorID = 4 },
337 new { MentorGroupID = 5, Code = "1703", MentorID = 5 },
338 new { MentorGroupID = 6, Code = "1702", MentorID = 5 },
339 new { MentorGroupID = 7, Code = "1701", MentorID = 7 }
340 );
341 });
342
343 modelBuilder.Entity("Api.Models.Module", b =>
344 {
345 b.Property<int>("ModuleID")
346 .ValueGeneratedOnAdd();
347
348 b.Property<int>("CourseID");
349
350 b.Property<string>("Description")
351 .HasMaxLength(1000);
352
353 b.Property<int>("Intensity");
354
355 b.Property<string>("Level");
356
357 b.Property<string>("Name")
358 .IsRequired();
359
360 b.Property<string>("Type")
361 .IsRequired();
362
363 b.HasKey("ModuleID");
364
365 b.HasIndex("CourseID");
366
367 b.ToTable("Modules");
368
369 b.HasData(
370 new { ModuleID = 1, CourseID = 1, Description = "learning trends in INformation Technology", Intensity = 8, Level = "3.2", Name = "ETI", Type = "Elective" },
371 new { ModuleID = 3, CourseID = 2, Description = "Learn about different types of information systems", Intensity = 5, Level = "1.1", Name = "EIS", Type = "Core" },
372 new { ModuleID = 4, CourseID = 1, Description = "Learn the basic concept of relations & functions", Intensity = 5, Level = "1.1", Name = "CM", Type = "Core" },
373 new { ModuleID = 5, CourseID = 4, Description = "learning key concepts in computer science", Intensity = 10, Level = "2.2", Name = "DSA", Type = "Core" },
374 new { ModuleID = 6, CourseID = 5, Description = "Basic theory and concepts of accounting through the introduction of Business Structures", Intensity = 7, Level = "1.2", Name = "Accounting", Type = "Core" }
375 );
376 });
377
378 modelBuilder.Entity("Api.Models.Room", b =>
379 {
380 b.Property<int>("RoomID")
381 .ValueGeneratedOnAdd();
382
383 b.Property<string>("Availability");
384
385 b.Property<int>("BuildingID");
386
387 b.Property<string>("RoomNo");
388
389 b.HasKey("RoomID");
390
391 b.HasIndex("BuildingID");
392
393 b.ToTable("Rooms");
394
395 b.HasData(
396 new { RoomID = 1, Availability = "Available", BuildingID = 1, RoomNo = "04-12" }
397 );
398 });
399
400 modelBuilder.Entity("Api.Models.Store", b =>
401 {
402 b.Property<int>("StoreID")
403 .ValueGeneratedOnAdd();
404
405 b.Property<int>("CanteenID");
406
407 b.Property<string>("Description")
408 .IsRequired()
409 .HasMaxLength(500);
410
411 b.Property<string>("Name")
412 .IsRequired();
413
414 b.HasKey("StoreID");
415
416 b.HasIndex("CanteenID");
417
418 b.ToTable("Stores");
419
420 b.HasData(
421 new { StoreID = 1, CanteenID = 1, Description = "Serving you delicious western delights", Name = "Western" }
422 );
423 });
424
425 modelBuilder.Entity("Api.Models.Student", b =>
426 {
427 b.Property<int>("StudentID")
428 .ValueGeneratedOnAdd();
429
430 b.Property<int>("CourseID");
431
432 b.Property<DateTime>("EnrollmentDate");
433
434 b.Property<int?>("EventID");
435
436 b.Property<int?>("FactionID");
437
438 b.Property<string>("FirstMidName")
439 .IsRequired();
440
441 b.Property<string>("LastName")
442 .IsRequired();
443
444 b.Property<int>("MentorGroupID");
445
446 b.Property<int>("RedemptionBal");
447
448 b.Property<int>("StudentNo");
449
450 b.HasKey("StudentID");
451
452 b.HasIndex("CourseID");
453
454 b.HasIndex("EventID");
455
456 b.HasIndex("FactionID");
457
458 b.HasIndex("MentorGroupID");
459
460 b.ToTable("Students");
461
462 b.HasData(
463 new { StudentID = 1, CourseID = 1, EnrollmentDate = new DateTime(2019, 9, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), FirstMidName = "Wong", LastName = "Chew", MentorGroupID = 1, RedemptionBal = 0, StudentNo = 10181158 },
464 new { StudentID = 2, CourseID = 1, EnrollmentDate = new DateTime(2019, 9, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), FirstMidName = "King", LastName = "Jack", MentorGroupID = 1, RedemptionBal = 0, StudentNo = 10172121 },
465 new { StudentID = 3, CourseID = 1, EnrollmentDate = new DateTime(2019, 9, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), FirstMidName = "Queen", LastName = "Spade", MentorGroupID = 1, RedemptionBal = 0, StudentNo = 10112313 },
466 new { StudentID = 4, CourseID = 1, EnrollmentDate = new DateTime(2019, 9, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), FirstMidName = "Queen", LastName = "Spade", MentorGroupID = 1, RedemptionBal = 0, StudentNo = 10165212 }
467 );
468 });
469
470 modelBuilder.Entity("Api.Models.StudentAward", b =>
471 {
472 b.Property<int>("StudentID");
473
474 b.Property<int>("AwardID");
475
476 b.HasKey("StudentID", "AwardID");
477
478 b.HasIndex("AwardID");
479
480 b.ToTable("StudentAwards");
481 });
482
483 modelBuilder.Entity("Api.Models.StudentCca", b =>
484 {
485 b.Property<int>("StudentID");
486
487 b.Property<int>("CCaID");
488
489 b.HasKey("StudentID", "CCaID");
490
491 b.HasIndex("CCaID");
492
493 b.ToTable("StudentCcas");
494 });
495
496 modelBuilder.Entity("Api.Models.StudentEvent", b =>
497 {
498 b.Property<int>("StudentID");
499
500 b.Property<int>("EventID");
501
502 b.HasKey("StudentID", "EventID");
503
504 b.HasIndex("EventID");
505
506 b.ToTable("StudentEvents");
507 });
508
509 modelBuilder.Entity("Api.Models.Canteen", b =>
510 {
511 b.HasOne("Api.Models.Building", "Building")
512 .WithOne("Canteen")
513 .HasForeignKey("Api.Models.Canteen", "BuildingID");
514 });
515
516 modelBuilder.Entity("Api.Models.Cca", b =>
517 {
518 b.HasOne("Api.Models.Student")
519 .WithMany("Ccas")
520 .HasForeignKey("StudentID");
521 });
522
523 modelBuilder.Entity("Api.Models.Event", b =>
524 {
525 b.HasOne("Api.Models.Student")
526 .WithMany("Events")
527 .HasForeignKey("StudentID");
528 });
529
530 modelBuilder.Entity("Api.Models.FoodItem", b =>
531 {
532 b.HasOne("Api.Models.Store", "Store")
533 .WithMany("FoodItems")
534 .HasForeignKey("StoreID");
535 });
536
537 modelBuilder.Entity("Api.Models.MedicalCertificate", b =>
538 {
539 b.HasOne("Api.Models.Mentor", "Mentor")
540 .WithMany("MCs")
541 .HasForeignKey("MentorID");
542
543 b.HasOne("Api.Models.Student", "Student")
544 .WithMany("MCs")
545 .HasForeignKey("StudentID");
546 });
547
548 modelBuilder.Entity("Api.Models.Mentor", b =>
549 {
550 b.HasOne("Api.Models.MentorGroup", "MentorGroup")
551 .WithOne("Mentor")
552 .HasForeignKey("Api.Models.Mentor", "MentorGroupID")
553 .OnDelete(DeleteBehavior.Cascade);
554 });
555
556 modelBuilder.Entity("Api.Models.Module", b =>
557 {
558 b.HasOne("Api.Models.Course", "Course")
559 .WithMany("Modules")
560 .HasForeignKey("CourseID")
561 .OnDelete(DeleteBehavior.Cascade);
562 });
563
564 modelBuilder.Entity("Api.Models.Room", b =>
565 {
566 b.HasOne("Api.Models.Building", "Building")
567 .WithMany("Rooms")
568 .HasForeignKey("BuildingID")
569 .OnDelete(DeleteBehavior.Cascade);
570 });
571
572 modelBuilder.Entity("Api.Models.Store", b =>
573 {
574 b.HasOne("Api.Models.Canteen", "Canteen")
575 .WithMany("Stores")
576 .HasForeignKey("CanteenID")
577 .OnDelete(DeleteBehavior.Cascade);
578 });
579
580 modelBuilder.Entity("Api.Models.Student", b =>
581 {
582 b.HasOne("Api.Models.Course", "Course")
583 .WithMany("Students")
584 .HasForeignKey("CourseID")
585 .OnDelete(DeleteBehavior.Cascade);
586
587 b.HasOne("Api.Models.Event", "Event")
588 .WithMany("Students")
589 .HasForeignKey("EventID");
590
591 b.HasOne("Api.Models.Faction", "Faction")
592 .WithMany("students")
593 .HasForeignKey("FactionID");
594
595 b.HasOne("Api.Models.MentorGroup", "MentorGroup")
596 .WithMany("Students")
597 .HasForeignKey("MentorGroupID")
598 .OnDelete(DeleteBehavior.Cascade);
599 });
600
601 modelBuilder.Entity("Api.Models.StudentAward", b =>
602 {
603 b.HasOne("Api.Models.Award", "Award")
604 .WithMany("StudentAwards")
605 .HasForeignKey("AwardID")
606 .OnDelete(DeleteBehavior.Cascade);
607
608 b.HasOne("Api.Models.Student", "Student")
609 .WithMany("StudentAwards")
610 .HasForeignKey("StudentID")
611 .OnDelete(DeleteBehavior.Cascade);
612 });
613
614 modelBuilder.Entity("Api.Models.StudentCca", b =>
615 {
616 b.HasOne("Api.Models.Cca", "Cca")
617 .WithMany("StudentCcas")
618 .HasForeignKey("CCaID")
619 .OnDelete(DeleteBehavior.Cascade);
620
621 b.HasOne("Api.Models.Student", "Student")
622 .WithMany("StudentCcas")
623 .HasForeignKey("StudentID")
624 .OnDelete(DeleteBehavior.Cascade);
625 });
626
627 modelBuilder.Entity("Api.Models.StudentEvent", b =>
628 {
629 b.HasOne("Api.Models.Event", "Event")
630 .WithMany("StudentEvents")
631 .HasForeignKey("EventID")
632 .OnDelete(DeleteBehavior.Cascade);
633
634 b.HasOne("Api.Models.Student", "Student")
635 .WithMany("StudentEvents")
636 .HasForeignKey("StudentID")
637 .OnDelete(DeleteBehavior.Cascade);
638 });
639#pragma warning restore 612, 618
640 }
641 }
642}