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
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
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")
......@@ -560,6 +588,17 @@ namespace Tsi1.DataLayer.Migrations
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")
......
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