aboutsummaryrefslogtreecommitdiff
path: root/src/Enmarcha.Backend/Data/Migrations/20260401135403_AddPushNotifications.cs
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2026-04-02 12:38:10 +0200
committerAriel Costas Guerrero <ariel@costas.dev>2026-04-02 12:45:33 +0200
commit1b4f4a674ac533c0b51260ba35ab91dd2cf9486d (patch)
tree9fdaf418bef86c51737bcf203483089c9e2b908b /src/Enmarcha.Backend/Data/Migrations/20260401135403_AddPushNotifications.cs
parent749e04d6fc2304bb29920db297d1fa4d73b57648 (diff)
Basic push notification system for service alerts
Co-authored-by: Copilot <copilot@github.com>
Diffstat (limited to 'src/Enmarcha.Backend/Data/Migrations/20260401135403_AddPushNotifications.cs')
-rw-r--r--src/Enmarcha.Backend/Data/Migrations/20260401135403_AddPushNotifications.cs74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/Enmarcha.Backend/Data/Migrations/20260401135403_AddPushNotifications.cs b/src/Enmarcha.Backend/Data/Migrations/20260401135403_AddPushNotifications.cs
new file mode 100644
index 0000000..964a86f
--- /dev/null
+++ b/src/Enmarcha.Backend/Data/Migrations/20260401135403_AddPushNotifications.cs
@@ -0,0 +1,74 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Data.Migrations
+{
+ /// <inheritdoc />
+ public partial class AddPushNotifications : Migration
+ {
+ /// <inheritdoc />
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<DateTime>(
+ name: "active_notified_at",
+ table: "service_alerts",
+ type: "timestamp with time zone",
+ nullable: true);
+
+ migrationBuilder.AddColumn<DateTime>(
+ name: "pre_notice_notified_at",
+ table: "service_alerts",
+ type: "timestamp with time zone",
+ nullable: true);
+
+ migrationBuilder.AddColumn<int>(
+ name: "version",
+ table: "service_alerts",
+ type: "integer",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.CreateTable(
+ name: "push_subscriptions",
+ columns: table => new
+ {
+ id = table.Column<Guid>(type: "uuid", nullable: false),
+ endpoint = table.Column<string>(type: "text", nullable: false),
+ p256dh_key = table.Column<string>(type: "text", nullable: false),
+ auth_key = table.Column<string>(type: "text", nullable: false),
+ created_at = table.Column<DateTime>(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);
+ }
+
+ /// <inheritdoc />
+ 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");
+ }
+ }
+}