Huge work

This commit is contained in:
Karolis Kundrotas
2021-10-25 22:00:01 +03:00
parent c3bb8983ef
commit aff6f8df82
26 changed files with 578 additions and 68 deletions

View File

@@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace KTUSAPS.Data.Migrations
{
[DbContext(typeof(SAPSDataContext))]
[Migration("20210909173149_Initial")]
[Migration("20211015122630_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -50,6 +50,9 @@ namespace KTUSAPS.Data.Migrations
.HasMaxLength(320)
.HasColumnType("varchar(320)");
b.Property<int>("IssueTypeId")
.HasColumnType("int");
b.Property<bool>("Publishable")
.HasColumnType("tinyint(1)");
@@ -62,9 +65,28 @@ namespace KTUSAPS.Data.Migrations
b.HasKey("Id");
b.HasIndex("IssueTypeId");
b.ToTable("Issues");
});
modelBuilder.Entity("KTUSAPS.Data.Model.IssueType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("Name")
.HasColumnType("longtext");
b.Property<string>("NameEn")
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("IssueTypes");
});
modelBuilder.Entity("KTUSAPS.Data.Model.PublishedFeedback", b =>
{
b.Property<int>("Id")
@@ -169,6 +191,17 @@ namespace KTUSAPS.Data.Migrations
b.ToTable("Votes");
});
modelBuilder.Entity("KTUSAPS.Data.Model.Issue", b =>
{
b.HasOne("KTUSAPS.Data.Model.IssueType", "IssueType")
.WithMany("Issues")
.HasForeignKey("IssueTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("IssueType");
});
modelBuilder.Entity("KTUSAPS.Data.Model.PublishedFeedback", b =>
{
b.HasOne("KTUSAPS.Data.Model.Issue", "Issue")
@@ -211,6 +244,11 @@ namespace KTUSAPS.Data.Migrations
b.Navigation("Problem");
});
modelBuilder.Entity("KTUSAPS.Data.Model.IssueType", b =>
{
b.Navigation("Issues");
});
modelBuilder.Entity("KTUSAPS.Data.Model.PublishedProblem", b =>
{
b.Navigation("Votes");

View File

@@ -27,24 +27,19 @@ namespace KTUSAPS.Data.Migrations
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Issues",
name: "IssueTypes",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
UserID = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true)
Name = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Email = table.Column<string>(type: "varchar(320)", maxLength: 320, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Publishable = table.Column<bool>(type: "tinyint(1)", nullable: false),
Solved = table.Column<bool>(type: "tinyint(1)", nullable: false),
Created = table.Column<DateTime>(type: "datetime(6)", nullable: false),
Description = table.Column<string>(type: "longtext", nullable: true)
NameEn = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Issues", x => x.Id);
table.PrimaryKey("PK_IssueTypes", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
@@ -66,6 +61,35 @@ namespace KTUSAPS.Data.Migrations
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Issues",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
UserID = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Email = table.Column<string>(type: "varchar(320)", maxLength: 320, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Publishable = table.Column<bool>(type: "tinyint(1)", nullable: false),
Solved = table.Column<bool>(type: "tinyint(1)", nullable: false),
Created = table.Column<DateTime>(type: "datetime(6)", nullable: false),
Description = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IssueTypeId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Issues", x => x.Id);
table.ForeignKey(
name: "FK_Issues_IssueTypes_IssueTypeId",
column: x => x.IssueTypeId,
principalTable: "IssueTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "PublishedFeedbacks",
columns: table => new
@@ -147,6 +171,11 @@ namespace KTUSAPS.Data.Migrations
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_Issues_IssueTypeId",
table: "Issues",
column: "IssueTypeId");
migrationBuilder.CreateIndex(
name: "IX_PublishedFeedbacks_IssueId",
table: "PublishedFeedbacks",
@@ -190,6 +219,9 @@ namespace KTUSAPS.Data.Migrations
migrationBuilder.DropTable(
name: "Solutions");
migrationBuilder.DropTable(
name: "IssueTypes");
}
}
}

View File

@@ -48,6 +48,9 @@ namespace KTUSAPS.Data.Migrations
.HasMaxLength(320)
.HasColumnType("varchar(320)");
b.Property<int>("IssueTypeId")
.HasColumnType("int");
b.Property<bool>("Publishable")
.HasColumnType("tinyint(1)");
@@ -60,9 +63,28 @@ namespace KTUSAPS.Data.Migrations
b.HasKey("Id");
b.HasIndex("IssueTypeId");
b.ToTable("Issues");
});
modelBuilder.Entity("KTUSAPS.Data.Model.IssueType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("Name")
.HasColumnType("longtext");
b.Property<string>("NameEn")
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("IssueTypes");
});
modelBuilder.Entity("KTUSAPS.Data.Model.PublishedFeedback", b =>
{
b.Property<int>("Id")
@@ -167,6 +189,17 @@ namespace KTUSAPS.Data.Migrations
b.ToTable("Votes");
});
modelBuilder.Entity("KTUSAPS.Data.Model.Issue", b =>
{
b.HasOne("KTUSAPS.Data.Model.IssueType", "IssueType")
.WithMany("Issues")
.HasForeignKey("IssueTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("IssueType");
});
modelBuilder.Entity("KTUSAPS.Data.Model.PublishedFeedback", b =>
{
b.HasOne("KTUSAPS.Data.Model.Issue", "Issue")
@@ -209,6 +242,11 @@ namespace KTUSAPS.Data.Migrations
b.Navigation("Problem");
});
modelBuilder.Entity("KTUSAPS.Data.Model.IssueType", b =>
{
b.Navigation("Issues");
});
modelBuilder.Entity("KTUSAPS.Data.Model.PublishedProblem", b =>
{
b.Navigation("Votes");