DocSpace-client/migrations/mysql/WebhooksDbContext/20220724114542_WebhooksDbContextMigrate.cs

75 lines
3.6 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ASC.Migrations.MySql.Migrations
{
public partial class WebhooksDbContextMigrate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "webhooks_config",
columns: table => new
{
config_id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
secret_key = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, defaultValueSql: "''")
.Annotation("MySql:CharSet", "utf8"),
tenant_id = table.Column<uint>(type: "int unsigned", nullable: false),
uri = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, defaultValueSql: "''")
.Annotation("MySql:CharSet", "utf8")
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => x.config_id);
})
.Annotation("MySql:CharSet", "utf8");
migrationBuilder.CreateTable(
name: "webhooks_logs",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
config_id = table.Column<int>(type: "int", nullable: false),
creation_time = table.Column<DateTime>(type: "datetime", nullable: false),
@event = table.Column<string>(name: "event", type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8"),
request_headers = table.Column<string>(type: "json", nullable: true)
.Annotation("MySql:CharSet", "utf8"),
request_payload = table.Column<string>(type: "json", nullable: false)
.Annotation("MySql:CharSet", "utf8"),
response_headers = table.Column<string>(type: "json", nullable: true)
.Annotation("MySql:CharSet", "utf8"),
response_payload = table.Column<string>(type: "json", nullable: true)
.Annotation("MySql:CharSet", "utf8"),
status = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8"),
tenant_id = table.Column<uint>(type: "int unsigned", nullable: false),
uid = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
.Annotation("MySql:CharSet", "utf8")
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => x.id);
})
.Annotation("MySql:CharSet", "utf8");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "webhooks_config");
migrationBuilder.DropTable(
name: "webhooks_logs");
}
}
}