Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

20220815162411_AddedWebhookTables.cs 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Diligent.WebAPI.Data.Migrations
  5. {
  6. public partial class AddedWebhookTables : Migration
  7. {
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.CreateTable(
  11. name: "WebhookDefinitions",
  12. columns: table => new
  13. {
  14. Id = table.Column<long>(type: "bigint", nullable: false)
  15. .Annotation("SqlServer:Identity", "1, 1"),
  16. Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  17. DisplayName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  18. Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
  19. CreatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
  20. UpdatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
  21. DeletedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true)
  22. },
  23. constraints: table =>
  24. {
  25. table.PrimaryKey("PK_WebhookDefinitions", x => x.Id);
  26. });
  27. migrationBuilder.CreateTable(
  28. name: "WebhookSubscriptions",
  29. columns: table => new
  30. {
  31. Id = table.Column<long>(type: "bigint", nullable: false)
  32. .Annotation("SqlServer:Identity", "1, 1"),
  33. WebhookURL = table.Column<string>(type: "nvarchar(max)", nullable: false),
  34. IsActive = table.Column<bool>(type: "bit", nullable: false),
  35. WebhookDefinitionId = table.Column<long>(type: "bigint", nullable: false),
  36. CreatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
  37. UpdatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
  38. DeletedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true)
  39. },
  40. constraints: table =>
  41. {
  42. table.PrimaryKey("PK_WebhookSubscriptions", x => x.Id);
  43. table.ForeignKey(
  44. name: "FK_WebhookSubscriptions_WebhookDefinitions_WebhookDefinitionId",
  45. column: x => x.WebhookDefinitionId,
  46. principalTable: "WebhookDefinitions",
  47. principalColumn: "Id",
  48. onDelete: ReferentialAction.Cascade);
  49. });
  50. migrationBuilder.CreateIndex(
  51. name: "IX_WebhookSubscriptions_WebhookDefinitionId",
  52. table: "WebhookSubscriptions",
  53. column: "WebhookDefinitionId");
  54. }
  55. protected override void Down(MigrationBuilder migrationBuilder)
  56. {
  57. migrationBuilder.DropTable(
  58. name: "WebhookSubscriptions");
  59. migrationBuilder.DropTable(
  60. name: "WebhookDefinitions");
  61. }
  62. }
  63. }