Files
zap-stream-api/NostrStreamer/Migrations/20231218112430_PushSubscriptions.cs
2023-12-18 12:19:09 +00:00

68 lines
2.7 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NostrStreamer.Migrations
{
/// <inheritdoc />
public partial class PushSubscriptions : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PushSubscriptions",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Created = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
LastUsed = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Pubkey = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
Endpoint = table.Column<string>(type: "text", nullable: false),
Key = table.Column<string>(type: "text", nullable: false),
Auth = table.Column<string>(type: "text", nullable: false),
Scope = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PushSubscriptions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "PushSubscriptionTargets",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
SubscriberPubkey = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
TargetPubkey = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PushSubscriptionTargets", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_PushSubscriptionTargets_SubscriberPubkey_TargetPubkey",
table: "PushSubscriptionTargets",
columns: new[] { "SubscriberPubkey", "TargetPubkey" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_PushSubscriptionTargets_TargetPubkey",
table: "PushSubscriptionTargets",
column: "TargetPubkey");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PushSubscriptions");
migrationBuilder.DropTable(
name: "PushSubscriptionTargets");
}
}
}