using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Apimanager_backend.Migrations { /// public partial class addapirequestExampleTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "ApiKey", table: "Users", type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "Description", table: "Apis", type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "OneMinuteLimit", table: "Apipackages", type: "int", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "ApiRequestExample", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), ApiId = table.Column(type: "int", nullable: false), ResponseType = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Request = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Response = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_ApiRequestExample", x => x.Id); table.ForeignKey( name: "FK_ApiRequestExample_Apis_ApiId", column: x => x.ApiId, principalTable: "Apis", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_ApiRequestExample_ApiId", table: "ApiRequestExample", column: "ApiId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ApiRequestExample"); migrationBuilder.DropColumn( name: "ApiKey", table: "Users"); migrationBuilder.DropColumn( name: "Description", table: "Apis"); migrationBuilder.DropColumn( name: "OneMinuteLimit", table: "Apipackages"); } } }