DocSpace-client/common/ASC.Webhooks.Core/Migrations/20210813105637_WebhooksDbContextMySql.cs
2021-08-26 21:43:41 +03:00

65 lines
2.9 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ASC.Webhooks.Core.Migrations
{
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
{
ConfigID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
TenantId = table.Column<uint>(type: "int unsigned", nullable: false),
URI = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, defaultValueSql: "''")
.Annotation("MySql:CharSet", "utf8mb4"),
SecretKey = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, defaultValueSql: "''")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => x.ConfigID);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "webhooks_payload",
columns: table => new
{
ID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ConfigID = table.Column<int>(type: "int", nullable: false),
TenantID = table.Column<uint>(type: "int unsigned", nullable: false),
Data = table.Column<string>(type: "json", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
Event = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Status = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => x.ID);
})
.Annotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "webhooks_config");
migrationBuilder.DropTable(
name: "webhooks_payload");
}
}
}