using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Ring.Migrations
{
    /// 
    public partial class InitialMigration : Migration
    {
        /// 
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "notifications",
                columns: table => new
                {
                    id = table.Column(type: "uuid", nullable: false),
                    topic = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false),
                    title = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true),
                    subtitle = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true),
                    content = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true),
                    meta = table.Column>(type: "jsonb", nullable: true),
                    priority = table.Column(type: "integer", nullable: false),
                    viewed_at = table.Column(type: "timestamp with time zone", nullable: true),
                    account_id = table.Column(type: "uuid", nullable: false),
                    created_at = table.Column(type: "timestamp with time zone", nullable: false),
                    updated_at = table.Column(type: "timestamp with time zone", nullable: false),
                    deleted_at = table.Column(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_notifications", x => x.id);
                });
            migrationBuilder.CreateTable(
                name: "push_subscriptions",
                columns: table => new
                {
                    id = table.Column(type: "uuid", nullable: false),
                    account_id = table.Column(type: "uuid", nullable: false),
                    device_id = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: false),
                    device_token = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: false),
                    provider = table.Column(type: "integer", nullable: false),
                    count_delivered = table.Column(type: "integer", nullable: false),
                    last_used_at = table.Column(type: "timestamp with time zone", nullable: true),
                    created_at = table.Column(type: "timestamp with time zone", nullable: false),
                    updated_at = table.Column(type: "timestamp with time zone", nullable: false),
                    deleted_at = table.Column(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_push_subscriptions", x => x.id);
                });
            migrationBuilder.CreateIndex(
                name: "ix_push_subscriptions_account_id_device_id_deleted_at",
                table: "push_subscriptions",
                columns: new[] { "account_id", "device_id", "deleted_at" },
                unique: true);
        }
        /// 
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "notifications");
            migrationBuilder.DropTable(
                name: "push_subscriptions");
        }
    }
}