mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
116 lines
4.6 KiB
C#
116 lines
4.6 KiB
C#
using System;
|
|
using BTCPayServer.Data;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace BTCPayServer.Migrations
|
|
{
|
|
[DbContext(typeof(ApplicationDbContext))]
|
|
[Migration("20201108054749_webhooks")]
|
|
public partial class webhooks : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Webhooks",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(maxLength: 25, nullable: false),
|
|
Blob = table.Column<byte[]>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Webhooks", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "StoreWebhooks",
|
|
columns: table => new
|
|
{
|
|
StoreId = table.Column<string>(nullable: false),
|
|
WebhookId = table.Column<string>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_StoreWebhooks", x => new { x.StoreId, x.WebhookId });
|
|
table.ForeignKey(
|
|
name: "FK_StoreWebhooks_Stores_StoreId",
|
|
column: x => x.StoreId,
|
|
principalTable: "Stores",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_StoreWebhooks_Webhooks_WebhookId",
|
|
column: x => x.WebhookId,
|
|
principalTable: "Webhooks",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "WebhookDeliveries",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(maxLength: 25, nullable: false),
|
|
WebhookId = table.Column<string>(maxLength: 25, nullable: false),
|
|
Timestamp = table.Column<DateTimeOffset>(nullable: false),
|
|
Blob = table.Column<byte[]>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_WebhookDeliveries", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_WebhookDeliveries_Webhooks_WebhookId",
|
|
column: x => x.WebhookId,
|
|
principalTable: "Webhooks",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "InvoiceWebhookDeliveries",
|
|
columns: table => new
|
|
{
|
|
InvoiceId = table.Column<string>(nullable: false),
|
|
DeliveryId = table.Column<string>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_InvoiceWebhookDeliveries", x => new { x.InvoiceId, x.DeliveryId });
|
|
table.ForeignKey(
|
|
name: "FK_InvoiceWebhookDeliveries_WebhookDeliveries_DeliveryId",
|
|
column: x => x.DeliveryId,
|
|
principalTable: "WebhookDeliveries",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_InvoiceWebhookDeliveries_Invoices_InvoiceId",
|
|
column: x => x.InvoiceId,
|
|
principalTable: "Invoices",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WebhookDeliveries_WebhookId",
|
|
table: "WebhookDeliveries",
|
|
column: "WebhookId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "InvoiceWebhookDeliveries");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "StoreWebhooks");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "WebhookDeliveries");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Webhooks");
|
|
}
|
|
}
|
|
}
|