Editor povezava na db

This commit is contained in:
David Štaleker
2024-02-27 07:27:47 +01:00
parent 4df426dc10
commit e92956075f
24 changed files with 1033 additions and 47 deletions

View File

@@ -0,0 +1,94 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ZpcBulletinBoard.Migrations
{
/// <inheritdoc />
public partial class _3 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Notes_BulletinBoards_IdBulletinBoard",
table: "Notes");
migrationBuilder.RenameColumn(
name: "IdBulletinBoard",
table: "Notes",
newName: "IdBulletinBoardPage");
migrationBuilder.RenameIndex(
name: "IX_Notes_IdBulletinBoard",
table: "Notes",
newName: "IX_Notes_IdBulletinBoardPage");
migrationBuilder.CreateTable(
name: "BulletinBoardPage",
columns: table => new
{
IdBulletinBoardPage = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
IdBulletinBoard = table.Column<int>(type: "int", nullable: false),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Duration = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BulletinBoardPage", x => x.IdBulletinBoardPage);
table.ForeignKey(
name: "FK_BulletinBoardPage_BulletinBoards_IdBulletinBoard",
column: x => x.IdBulletinBoard,
principalTable: "BulletinBoards",
principalColumn: "IdBulletinBoard",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_BulletinBoardPage_IdBulletinBoard",
table: "BulletinBoardPage",
column: "IdBulletinBoard");
migrationBuilder.AddForeignKey(
name: "FK_Notes_BulletinBoardPage_IdBulletinBoardPage",
table: "Notes",
column: "IdBulletinBoardPage",
principalTable: "BulletinBoardPage",
principalColumn: "IdBulletinBoardPage",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Notes_BulletinBoardPage_IdBulletinBoardPage",
table: "Notes");
migrationBuilder.DropTable(
name: "BulletinBoardPage");
migrationBuilder.RenameColumn(
name: "IdBulletinBoardPage",
table: "Notes",
newName: "IdBulletinBoard");
migrationBuilder.RenameIndex(
name: "IX_Notes_IdBulletinBoardPage",
table: "Notes",
newName: "IX_Notes_IdBulletinBoard");
migrationBuilder.AddForeignKey(
name: "FK_Notes_BulletinBoards_IdBulletinBoard",
table: "Notes",
column: "IdBulletinBoard",
principalTable: "BulletinBoards",
principalColumn: "IdBulletinBoard",
onDelete: ReferentialAction.Cascade);
}
}
}