Skip to content
Snippets Groups Projects
Commit 5024cc9d authored by esantangelo's avatar esantangelo
Browse files

fix-migrations

parent 1b260c72
No related branches found
No related tags found
2 merge requests!26Develop,!25Feature/communications
......@@ -10,6 +10,8 @@ namespace Tsi1.DataLayer.Entities
public string Text { get; set; }
public bool IsGlobal { get; set; }
public DateTime ValidUntil { get; set; }
public Course Course { get; set; }
......
using Microsoft.EntityFrameworkCore.Migrations;
namespace Tsi1.DataLayer.Migrations
{
public partial class addcolumntocommunication : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Communication_Courses_CourseId",
table: "Communication");
migrationBuilder.DropForeignKey(
name: "FK_Communication_Tenants_TenantId",
table: "Communication");
migrationBuilder.DropPrimaryKey(
name: "PK_Communication",
table: "Communication");
migrationBuilder.RenameTable(
name: "Communication",
newName: "Communications");
migrationBuilder.RenameIndex(
name: "IX_Communication_TenantId",
table: "Communications",
newName: "IX_Communications_TenantId");
migrationBuilder.RenameIndex(
name: "IX_Communication_CourseId",
table: "Communications",
newName: "IX_Communications_CourseId");
migrationBuilder.AlterColumn<string>(
name: "Text",
table: "Communications",
type: "character varying(1000)",
nullable: false,
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsGlobal",
table: "Communications",
nullable: false,
defaultValue: false);
migrationBuilder.AddPrimaryKey(
name: "PK_Communications",
table: "Communications",
column: "Id");
migrationBuilder.CreateIndex(
name: "IX_Communications_ValidUntil",
table: "Communications",
column: "ValidUntil");
migrationBuilder.AddForeignKey(
name: "FK_Communications_Courses_CourseId",
table: "Communications",
column: "CourseId",
principalTable: "Courses",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Communications_Tenants_TenantId",
table: "Communications",
column: "TenantId",
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Communications_Courses_CourseId",
table: "Communications");
migrationBuilder.DropForeignKey(
name: "FK_Communications_Tenants_TenantId",
table: "Communications");
migrationBuilder.DropPrimaryKey(
name: "PK_Communications",
table: "Communications");
migrationBuilder.DropIndex(
name: "IX_Communications_ValidUntil",
table: "Communications");
migrationBuilder.DropColumn(
name: "IsGlobal",
table: "Communications");
migrationBuilder.RenameTable(
name: "Communications",
newName: "Communication");
migrationBuilder.RenameIndex(
name: "IX_Communications_TenantId",
table: "Communication",
newName: "IX_Communication_TenantId");
migrationBuilder.RenameIndex(
name: "IX_Communications_CourseId",
table: "Communication",
newName: "IX_Communication_CourseId");
migrationBuilder.AlterColumn<string>(
name: "Text",
table: "Communication",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(1000)");
migrationBuilder.AddPrimaryKey(
name: "PK_Communication",
table: "Communication",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Communication_Courses_CourseId",
table: "Communication",
column: "CourseId",
principalTable: "Courses",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Communication_Tenants_TenantId",
table: "Communication",
column: "TenantId",
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}
......@@ -47,11 +47,15 @@ namespace Tsi1.DataLayer.Migrations
b.Property<int?>("CourseId")
.HasColumnType("integer");
b.Property<bool>("IsGlobal")
.HasColumnType("boolean");
b.Property<int?>("TenantId")
.HasColumnType("integer");
b.Property<string>("Text")
.HasColumnType("text");
.IsRequired()
.HasColumnType("character varying(1000)");
b.Property<DateTime>("ValidUntil")
.HasColumnType("timestamp without time zone");
......@@ -62,7 +66,9 @@ namespace Tsi1.DataLayer.Migrations
b.HasIndex("TenantId");
b.ToTable("Communication");
b.HasIndex("ValidUntil");
b.ToTable("Communications");
});
modelBuilder.Entity("Tsi1.DataLayer.Entities.Connection", b =>
......
......@@ -33,6 +33,8 @@ namespace Tsi1.DataLayer
public DbSet<SurveyResponse> SurveyResponses { get; set; }
public DbSet<AnswerOption> AnswerOptions { get; set; }
public DbSet<Communication> Communications { get; set; }
public Tsi1Context(DbContextOptions options) : base(options) { }
......@@ -62,6 +64,7 @@ namespace Tsi1.DataLayer
modelBuilder.ApplyConfiguration(new SurveyQuestionConfiguration());
modelBuilder.ApplyConfiguration(new SurveyResponseConfiguration());
modelBuilder.ApplyConfiguration(new AnswerOptionConfiguration());
modelBuilder.ApplyConfiguration(new CommunicationConfiguration());
}
}
}
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