using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Data.Migrations { /// public partial class AddPushNotifications : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "active_notified_at", table: "service_alerts", type: "timestamp with time zone", nullable: true); migrationBuilder.AddColumn( name: "pre_notice_notified_at", table: "service_alerts", type: "timestamp with time zone", nullable: true); migrationBuilder.AddColumn( name: "version", table: "service_alerts", type: "integer", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "push_subscriptions", columns: table => new { id = table.Column(type: "uuid", nullable: false), endpoint = table.Column(type: "text", nullable: false), p256dh_key = table.Column(type: "text", nullable: false), auth_key = table.Column(type: "text", nullable: false), created_at = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("pK_push_subscriptions", x => x.id); }); migrationBuilder.CreateIndex( name: "iX_push_subscriptions_endpoint", table: "push_subscriptions", column: "endpoint", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "push_subscriptions"); migrationBuilder.DropColumn( name: "active_notified_at", table: "service_alerts"); migrationBuilder.DropColumn( name: "pre_notice_notified_at", table: "service_alerts"); migrationBuilder.DropColumn( name: "version", table: "service_alerts"); } } }