87 lines
3.1 KiB
C#
87 lines
3.1 KiB
C#
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Apimanager_backend.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class addapirequestExampleTable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ApiKey",
|
|
table: "Users",
|
|
type: "longtext",
|
|
nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Description",
|
|
table: "Apis",
|
|
type: "longtext",
|
|
nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "OneMinuteLimit",
|
|
table: "Apipackages",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "ApiRequestExample",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
ApiId = table.Column<int>(type: "int", nullable: false),
|
|
ResponseType = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Request = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Response = table.Column<string>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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");
|
|
}
|
|
}
|
|
}
|