DocSpace-buildtools/common/ASC.Webhooks.Core/Migrations/20210902223117_WebhooksDbContextMySql.cs

74 lines
3.6 KiB
C#
Raw Normal View History

2021-10-19 16:53:28 +00:00
using System;
2021-08-19 09:11:26 +00:00
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
2021-08-26 18:43:41 +00:00
namespace ASC.Webhooks.Core.Migrations
2021-08-19 09:11:26 +00:00
{
public partial class WebhooksDbContextMySql : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "webhooks_config",
columns: table => new
{
2021-09-03 14:02:52 +00:00
config_id = table.Column<int>(type: "int", nullable: false)
2021-08-19 09:11:26 +00:00
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
2021-09-03 14:02:52 +00:00
tenant_id = table.Column<uint>(type: "int unsigned", nullable: false),
uri = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, defaultValueSql: "''")
2021-08-19 09:11:26 +00:00
.Annotation("MySql:CharSet", "utf8mb4"),
2021-09-03 14:02:52 +00:00
secret_key = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, defaultValueSql: "''")
2021-08-19 09:11:26 +00:00
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
2021-09-03 14:02:52 +00:00
table.PrimaryKey("PRIMARY", x => x.config_id);
2021-08-19 09:11:26 +00:00
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
2021-09-03 14:02:52 +00:00
name: "webhooks_logs",
2021-08-19 09:11:26 +00:00
columns: table => new
{
2021-09-03 14:02:52 +00:00
id = table.Column<int>(type: "int", nullable: false)
2021-08-19 09:11:26 +00:00
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
2021-09-03 14:02:52 +00:00
config_id = table.Column<int>(type: "int", nullable: false),
uid = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
2021-08-19 09:11:26 +00:00
.Annotation("MySql:CharSet", "utf8mb4"),
2021-09-03 14:02:52 +00:00
tenant_id = table.Column<uint>(type: "int unsigned", nullable: false),
request_payload = table.Column<string>(type: "json", nullable: false)
2021-08-19 09:11:26 +00:00
.Annotation("MySql:CharSet", "utf8mb4"),
2021-09-03 14:02:52 +00:00
request_headers = table.Column<string>(type: "json", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
response_payload = table.Column<string>(type: "json", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
response_headers = table.Column<string>(type: "json", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
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", "utf8mb4"),
status = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
2021-08-19 09:11:26 +00:00
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
2021-09-03 14:02:52 +00:00
table.PrimaryKey("PRIMARY", x => x.id);
2021-08-19 09:11:26 +00:00
})
.Annotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "webhooks_config");
migrationBuilder.DropTable(
2021-09-03 14:02:52 +00:00
name: "webhooks_logs");
2021-08-19 09:11:26 +00:00
}
}
}