Skip to content
Snippets Groups Projects
Commit 1b260c72 authored by esantangelo's avatar esantangelo
Browse files

migrations

parent 22122b5d
No related branches found
No related tags found
2 merge requests!26Develop,!25Feature/communications
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Tsi1.DataLayer;
namespace Tsi1.DataLayer.Migrations
{
[DbContext(typeof(Tsi1Context))]
[Migration("20201115152033_add-communication-entity")]
partial class addcommunicationentity
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Tsi1.DataLayer.Entities.AnswerOption", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("Name");
b.ToTable("AnswerOptions");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Communication", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int?>("CourseId")
.HasColumnType("integer");
b.Property<int?>("TenantId")
.HasColumnType("integer");
b.Property<string>("Text")
.HasColumnType("text");
b.Property<DateTime>("ValidUntil")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("CourseId");
b.HasIndex("TenantId");
b.ToTable("Communication");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Connection", b =>
{
b.Property<string>("ConnectionId")
.HasColumnType("text");
b.Property<string>("GroupName")
.HasColumnType("text");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("ConnectionId");
b.HasIndex("GroupName");
b.ToTable("Connections");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Course", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<bool>("IsTemplate")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(50)");
b.Property<int>("TenantId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("Name", "TenantId")
.IsUnique();
b.ToTable("Courses");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.File", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(50)");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("character varying(1000)");
b.HasKey("Id");
b.HasIndex("Path")
.IsUnique();
b.ToTable("Files");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Forum", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.ToTable("Forums");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.ForumUser", b =>
{
b.Property<int>("ForumId")
.HasColumnType("integer");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("ForumId", "UserId");
b.HasIndex("UserId");
b.ToTable("ForumUsers");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Group", b =>
{
b.Property<string>("Name")
.HasColumnType("text");
b.HasKey("Name");
b.ToTable("Groups");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Post", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("Date")
.HasColumnType("timestamp without time zone");
b.Property<int>("ForumId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("character varying(100)");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("ForumId", "Title")
.IsUnique();
b.ToTable("Posts");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.PostMessage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Content")
.IsRequired()
.HasColumnType("character varying(10485760)");
b.Property<DateTime>("Date")
.HasColumnType("timestamp without time zone");
b.Property<int>("PostId")
.HasColumnType("integer");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("PostId");
b.HasIndex("UserId");
b.ToTable("PostMessages");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Professor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("IdentityCard")
.IsRequired()
.HasColumnType("character varying(50)");
b.Property<int>("TenantId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("IdentityCard", "TenantId")
.IsUnique();
b.ToTable("Professors");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.ProfessorCourse", b =>
{
b.Property<int>("ProfessorId")
.HasColumnType("integer");
b.Property<int>("CourseId")
.HasColumnType("integer");
b.HasKey("ProfessorId", "CourseId");
b.HasIndex("CourseId");
b.ToTable("ProfessorCourses");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Section", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("CourseId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(255)");
b.Property<int>("Order")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CourseId");
b.ToTable("Sections");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.SectionItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int?>("FileId")
.HasColumnType("integer");
b.Property<int?>("ForumId")
.HasColumnType("integer");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<int>("SectionId")
.HasColumnType("integer");
b.Property<int>("SectionItemTypeId")
.HasColumnType("integer");
b.Property<int?>("SurveyId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("FileId")
.IsUnique();
b.HasIndex("ForumId")
.IsUnique();
b.HasIndex("SectionId");
b.HasIndex("SectionItemTypeId");
b.HasIndex("SurveyId")
.IsUnique();
b.ToTable("SectionItems");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.SectionItemType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.ToTable("SectionItemTypes");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Student", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Age")
.HasColumnType("integer");
b.Property<string>("IdentityCard")
.IsRequired()
.HasColumnType("character varying(50)");
b.Property<int>("TenantId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("IdentityCard", "TenantId")
.IsUnique();
b.ToTable("Students");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.StudentCourse", b =>
{
b.Property<int>("StudentId")
.HasColumnType("integer");
b.Property<int>("CourseId")
.HasColumnType("integer");
b.HasKey("StudentId", "CourseId");
b.HasIndex("CourseId");
b.ToTable("StudentCourses");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Survey", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<bool>("IsGlobal")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(255)");
b.Property<int?>("TenantId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("Name");
b.HasIndex("TenantId");
b.ToTable("Surveys");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyAnswer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AnswerOptionId")
.HasColumnType("integer");
b.Property<int>("SurveyQuestionId")
.HasColumnType("integer");
b.Property<int>("SurveyResponseId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AnswerOptionId");
b.HasIndex("SurveyQuestionId");
b.HasIndex("SurveyResponseId");
b.ToTable("SurveyAnswers");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyQuestion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Question")
.IsRequired()
.HasColumnType("character varying(255)");
b.Property<int>("SurveyId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SurveyId");
b.ToTable("SurveyQuestions");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyResponse", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("SurveyId")
.HasColumnType("integer");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SurveyId");
b.HasIndex("UserId");
b.ToTable("SurveyResponses");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Tenant", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Tenants");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Email")
.IsRequired()
.HasColumnType("character varying(255)");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("character varying(255)");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("character varying(255)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("character varying(255)");
b.Property<int?>("ProfessorId")
.HasColumnType("integer");
b.Property<int?>("StudentId")
.HasColumnType("integer");
b.Property<int>("TenantId")
.HasColumnType("integer");
b.Property<int>("UserTypeId")
.HasColumnType("integer");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasIndex("ProfessorId")
.IsUnique();
b.HasIndex("StudentId")
.IsUnique();
b.HasIndex("TenantId");
b.HasIndex("UserTypeId");
b.HasIndex("Username", "TenantId")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.UserType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("UserTypes");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Communication", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Course", "Course")
.WithMany("Communications")
.HasForeignKey("CourseId");
b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant")
.WithMany("Communications")
.HasForeignKey("TenantId");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Connection", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Group", "Group")
.WithMany("Connections")
.HasForeignKey("GroupName");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Course", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant")
.WithMany("Courses")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.ForumUser", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Forum", "Forum")
.WithMany("ForumUsers")
.HasForeignKey("ForumId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.User", "User")
.WithMany("ForumUsers")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Post", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Forum", "Forum")
.WithMany("Posts")
.HasForeignKey("ForumId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.User", "User")
.WithMany("Posts")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.PostMessage", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Post", "Post")
.WithMany("PostMessages")
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.User", "User")
.WithMany("PostMessages")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Professor", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant")
.WithMany("Professors")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.ProfessorCourse", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Course", "Course")
.WithMany("ProfessorCourses")
.HasForeignKey("CourseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.Professor", "Professor")
.WithMany("ProfessorCourses")
.HasForeignKey("ProfessorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Section", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Course", "Course")
.WithMany("Sections")
.HasForeignKey("CourseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.SectionItem", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.File", "File")
.WithOne("SectionItem")
.HasForeignKey("Tsi1.DataLayer.Entities.SectionItem", "FileId");
b.HasOne("Tsi1.DataLayer.Entities.Forum", "Forum")
.WithOne("SectionItem")
.HasForeignKey("Tsi1.DataLayer.Entities.SectionItem", "ForumId");
b.HasOne("Tsi1.DataLayer.Entities.Section", "Section")
.WithMany("SectionItems")
.HasForeignKey("SectionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.SectionItemType", "SectionItemType")
.WithMany("SectionItems")
.HasForeignKey("SectionItemTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.Survey", "Survey")
.WithOne("SectionItem")
.HasForeignKey("Tsi1.DataLayer.Entities.SectionItem", "SurveyId");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Student", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant")
.WithMany("Students")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.StudentCourse", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Course", "Course")
.WithMany("StudentCourses")
.HasForeignKey("CourseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.Student", "Student")
.WithMany("StudentCourses")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Survey", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant")
.WithMany("Surveys")
.HasForeignKey("TenantId");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyAnswer", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.AnswerOption", "AnswerOption")
.WithMany("SurveyAnswers")
.HasForeignKey("AnswerOptionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.SurveyQuestion", "SurveyQuestion")
.WithMany("SurveyAnswers")
.HasForeignKey("SurveyQuestionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.SurveyResponse", "SurveyResponse")
.WithMany("SurveyAnswers")
.HasForeignKey("SurveyResponseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyQuestion", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Survey", "Survey")
.WithMany("SurveyQuestions")
.HasForeignKey("SurveyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyResponse", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Survey", "Survey")
.WithMany("SurveyResponses")
.HasForeignKey("SurveyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.User", "User")
.WithMany("SurveyResponses")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.User", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Professor", "Professor")
.WithOne("User")
.HasForeignKey("Tsi1.DataLayer.Entities.User", "ProfessorId");
b.HasOne("Tsi1.DataLayer.Entities.Student", "Student")
.WithOne("User")
.HasForeignKey("Tsi1.DataLayer.Entities.User", "StudentId");
b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant")
.WithMany("Users")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Tsi1.DataLayer.Entities.UserType", "UserType")
.WithMany()
.HasForeignKey("UserTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Tsi1.DataLayer.Migrations
{
public partial class addcommunicationentity : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Communication",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Text = table.Column<string>(nullable: true),
ValidUntil = table.Column<DateTime>(nullable: false),
CourseId = table.Column<int>(nullable: true),
TenantId = table.Column<int>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Communication", x => x.Id);
table.ForeignKey(
name: "FK_Communication_Courses_CourseId",
column: x => x.CourseId,
principalTable: "Courses",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Communication_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_Communication_CourseId",
table: "Communication",
column: "CourseId");
migrationBuilder.CreateIndex(
name: "IX_Communication_TenantId",
table: "Communication",
column: "TenantId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Communication");
}
}
}
...@@ -37,6 +37,34 @@ namespace Tsi1.DataLayer.Migrations ...@@ -37,6 +37,34 @@ namespace Tsi1.DataLayer.Migrations
b.ToTable("AnswerOptions"); b.ToTable("AnswerOptions");
}); });
modelBuilder.Entity("Tsi1.DataLayer.Entities.Communication", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int?>("CourseId")
.HasColumnType("integer");
b.Property<int?>("TenantId")
.HasColumnType("integer");
b.Property<string>("Text")
.HasColumnType("text");
b.Property<DateTime>("ValidUntil")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("CourseId");
b.HasIndex("TenantId");
b.ToTable("Communication");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Connection", b => modelBuilder.Entity("Tsi1.DataLayer.Entities.Connection", b =>
{ {
b.Property<string>("ConnectionId") b.Property<string>("ConnectionId")
...@@ -560,6 +588,17 @@ namespace Tsi1.DataLayer.Migrations ...@@ -560,6 +588,17 @@ namespace Tsi1.DataLayer.Migrations
b.ToTable("UserTypes"); b.ToTable("UserTypes");
}); });
modelBuilder.Entity("Tsi1.DataLayer.Entities.Communication", b =>
{
b.HasOne("Tsi1.DataLayer.Entities.Course", "Course")
.WithMany("Communications")
.HasForeignKey("CourseId");
b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant")
.WithMany("Communications")
.HasForeignKey("TenantId");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Connection", b => modelBuilder.Entity("Tsi1.DataLayer.Entities.Connection", b =>
{ {
b.HasOne("Tsi1.DataLayer.Entities.Group", "Group") b.HasOne("Tsi1.DataLayer.Entities.Group", "Group")
......
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