Skip to content
Snippets Groups Projects
Commit 13ca6236 authored by esantangelo's avatar esantangelo
Browse files

migrations

parent c1b636dc
No related branches found
No related tags found
1 merge request!43Feature/results
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Tsi1.DataLayer.Migrations
{
public partial class addentityStudentCourseResult : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "StudentCourseResults",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Result = table.Column<int>(type: "integer", nullable: false),
Date = table.Column<DateTime>(nullable: false),
StudentId = table.Column<int>(nullable: false),
CourseId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StudentCourseResults", x => x.Id);
table.ForeignKey(
name: "FK_StudentCourseResults_Courses_CourseId",
column: x => x.CourseId,
principalTable: "Courses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_StudentCourseResults_Students_StudentId",
column: x => x.StudentId,
principalTable: "Students",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_StudentCourseResults_CourseId",
table: "StudentCourseResults",
column: "CourseId");
migrationBuilder.CreateIndex(
name: "IX_StudentCourseResults_StudentId",
table: "StudentCourseResults",
column: "StudentId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "StudentCourseResults");
}
}
}
......@@ -530,6 +530,34 @@ namespace Tsi1.DataLayer.Migrations
b.ToTable("StudentCourses");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.StudentCourseResult", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("CourseId")
.HasColumnType("integer");
b.Property<DateTime>("Date")
.HasColumnType("timestamp without time zone");
b.Property<int>("Result")
.HasColumnType("integer");
b.Property<int>("StudentId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CourseId");
b.HasIndex("StudentId");
b.ToTable("StudentCourseResults");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Submission", b =>
{
b.Property<int>("Id")
......@@ -975,6 +1003,21 @@ namespace Tsi1.DataLayer.Migrations
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.StudentCourseResult", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Course", "Course")
.WithMany("StudentCourseResults")
.HasForeignKey("CourseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.Student", "Student")
.WithMany("StudentCourseResults")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Submission", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Evaluation", null)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment