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: "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") }, 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), IdBulletinBoard = 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), Title = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Content = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_Notes", x => x.IdNote); table.ForeignKey( name: "FK_Notes_BulletinBoards_IdBulletinBoard", column: x => x.IdBulletinBoard, principalTable: "BulletinBoards", principalColumn: "IdBulletinBoard", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_Notes_IdBulletinBoard", table: "Notes", column: "IdBulletinBoard"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Notes"); migrationBuilder.DropTable( name: "BulletinBoards"); } } }