| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
-
- #nullable disable
-
- namespace Diligent.WebAPI.Data.Migrations
- {
- public partial class AddedWebhookTables : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "WebhookDefinitions",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
- DisplayName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
- Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
- CreatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
- DeletedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_WebhookDefinitions", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "WebhookSubscriptions",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- WebhookURL = table.Column<string>(type: "nvarchar(max)", nullable: false),
- IsActive = table.Column<bool>(type: "bit", nullable: false),
- WebhookDefinitionId = table.Column<long>(type: "bigint", nullable: false),
- CreatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
- DeletedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_WebhookSubscriptions", x => x.Id);
- table.ForeignKey(
- name: "FK_WebhookSubscriptions_WebhookDefinitions_WebhookDefinitionId",
- column: x => x.WebhookDefinitionId,
- principalTable: "WebhookDefinitions",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_WebhookSubscriptions_WebhookDefinitionId",
- table: "WebhookSubscriptions",
- column: "WebhookDefinitionId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "WebhookSubscriptions");
-
- migrationBuilder.DropTable(
- name: "WebhookDefinitions");
- }
- }
- }
|