143 lines
6.6 KiB
C#
143 lines
6.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ZpcBulletinBoard.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class _1 : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "BulletinBoardPage",
|
|
columns: table => new
|
|
{
|
|
IdBulletinBoardPage = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Ratio = table.Column<int>(type: "int", nullable: false),
|
|
Type = table.Column<int>(type: "int", nullable: false),
|
|
ExternalLink = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_BulletinBoardPage", x => x.IdBulletinBoardPage);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "BulletinBoards",
|
|
columns: table => new
|
|
{
|
|
IdBulletinBoard = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Guid = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Ratio = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_BulletinBoards", x => x.IdBulletinBoard);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Notes",
|
|
columns: table => new
|
|
{
|
|
IdNote = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
IdBulletinBoardPage = table.Column<int>(type: "int", nullable: false),
|
|
X = table.Column<int>(type: "int", nullable: false),
|
|
Y = table.Column<int>(type: "int", nullable: false),
|
|
Width = table.Column<int>(type: "int", nullable: false),
|
|
Height = table.Column<int>(type: "int", nullable: false),
|
|
Content = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Zindex = table.Column<int>(type: "int", nullable: false),
|
|
ColorClass = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Type = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Notes", x => x.IdNote);
|
|
table.ForeignKey(
|
|
name: "FK_Notes_BulletinBoardPage_IdBulletinBoardPage",
|
|
column: x => x.IdBulletinBoardPage,
|
|
principalTable: "BulletinBoardPage",
|
|
principalColumn: "IdBulletinBoardPage",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "BulletinBoardPageLinks",
|
|
columns: table => new
|
|
{
|
|
IdLink = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
IdBulletinBoardFk = table.Column<int>(type: "int", nullable: false),
|
|
IdBulletinBoardPageFk = table.Column<int>(type: "int", nullable: false),
|
|
Duration = table.Column<int>(type: "int", nullable: false),
|
|
Order = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_BulletinBoardPageLinks", x => x.IdLink);
|
|
table.ForeignKey(
|
|
name: "FK_BulletinBoardPageLinks_BulletinBoardPage_IdBulletinBoardPage~",
|
|
column: x => x.IdBulletinBoardPageFk,
|
|
principalTable: "BulletinBoardPage",
|
|
principalColumn: "IdBulletinBoardPage",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_BulletinBoardPageLinks_BulletinBoards_IdBulletinBoardFk",
|
|
column: x => x.IdBulletinBoardFk,
|
|
principalTable: "BulletinBoards",
|
|
principalColumn: "IdBulletinBoard",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_BulletinBoardPageLinks_IdBulletinBoardFk",
|
|
table: "BulletinBoardPageLinks",
|
|
column: "IdBulletinBoardFk");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_BulletinBoardPageLinks_IdBulletinBoardPageFk",
|
|
table: "BulletinBoardPageLinks",
|
|
column: "IdBulletinBoardPageFk");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notes_IdBulletinBoardPage",
|
|
table: "Notes",
|
|
column: "IdBulletinBoardPage");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "BulletinBoardPageLinks");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Notes");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "BulletinBoards");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "BulletinBoardPage");
|
|
}
|
|
}
|
|
}
|