using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ZpcBulletinBoard.Migrations { /// public partial class _1 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "BulletinBoardPage", columns: table => new { IdBulletinBoardPage = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Ratio = table.Column(type: "int", nullable: false), Type = table.Column(type: "int", nullable: false), ExternalLink = table.Column(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(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Guid = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Name = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Ratio = table.Column(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(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), IdBulletinBoardPage = table.Column(type: "int", nullable: false), X = table.Column(type: "int", nullable: false), Y = table.Column(type: "int", nullable: false), Width = table.Column(type: "int", nullable: false), Height = table.Column(type: "int", nullable: false), Content = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Zindex = table.Column(type: "int", nullable: false), ColorClass = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Type = table.Column(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(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), IdBulletinBoardFk = table.Column(type: "int", nullable: false), IdBulletinBoardPageFk = table.Column(type: "int", nullable: false), Duration = table.Column(type: "int", nullable: false), Order = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "BulletinBoardPageLinks"); migrationBuilder.DropTable( name: "Notes"); migrationBuilder.DropTable( name: "BulletinBoards"); migrationBuilder.DropTable( name: "BulletinBoardPage"); } } }