using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NostrStreamer.Migrations
{
///
public partial class PushSubscriptions : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PushSubscriptions",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
Created = table.Column(type: "timestamp with time zone", nullable: false),
LastUsed = table.Column(type: "timestamp with time zone", nullable: false),
Pubkey = table.Column(type: "character varying(64)", maxLength: 64, nullable: false),
Endpoint = table.Column(type: "text", nullable: false),
Key = table.Column(type: "text", nullable: false),
Auth = table.Column(type: "text", nullable: false),
Scope = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PushSubscriptions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "PushSubscriptionTargets",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
SubscriberPubkey = table.Column(type: "character varying(64)", maxLength: 64, nullable: false),
TargetPubkey = table.Column(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");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PushSubscriptions");
migrationBuilder.DropTable(
name: "PushSubscriptionTargets");
}
}
}