diff --git a/DysonNetwork.Pusher/Migrations/20250724065831_UpdateDatabaseSomehow.Designer.cs b/DysonNetwork.Pusher/Migrations/20250724065831_UpdateDatabaseSomehow.Designer.cs new file mode 100644 index 0000000..88b4420 --- /dev/null +++ b/DysonNetwork.Pusher/Migrations/20250724065831_UpdateDatabaseSomehow.Designer.cs @@ -0,0 +1,152 @@ +// +using System; +using System.Collections.Generic; +using DysonNetwork.Pusher; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodaTime; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace DysonNetwork.Pusher.Migrations +{ + [DbContext(typeof(AppDatabase))] + [Migration("20250724065831_UpdateDatabaseSomehow")] + partial class UpdateDatabaseSomehow + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("DysonNetwork.Pusher.Notification.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AccountId") + .HasColumnType("uuid") + .HasColumnName("account_id"); + + b.Property("Content") + .HasMaxLength(4096) + .HasColumnType("character varying(4096)") + .HasColumnName("content"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property>("Meta") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("meta"); + + b.Property("Priority") + .HasColumnType("integer") + .HasColumnName("priority"); + + b.Property("Subtitle") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)") + .HasColumnName("subtitle"); + + b.Property("Title") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("title"); + + b.Property("Topic") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("topic"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("updated_at"); + + b.Property("ViewedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("viewed_at"); + + b.HasKey("Id") + .HasName("pk_notifications"); + + b.ToTable("notifications", (string)null); + }); + + modelBuilder.Entity("DysonNetwork.Pusher.Notification.PushSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AccountId") + .HasColumnType("uuid") + .HasColumnName("account_id"); + + b.Property("CountDelivered") + .HasColumnType("integer") + .HasColumnName("count_delivered"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeviceId") + .IsRequired() + .HasMaxLength(8192) + .HasColumnType("character varying(8192)") + .HasColumnName("device_id"); + + b.Property("DeviceToken") + .IsRequired() + .HasMaxLength(8192) + .HasColumnType("character varying(8192)") + .HasColumnName("device_token"); + + b.Property("LastUsedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_used_at"); + + b.Property("Provider") + .HasColumnType("integer") + .HasColumnName("provider"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id") + .HasName("pk_push_subscriptions"); + + b.HasIndex("AccountId", "DeviceId", "DeletedAt") + .IsUnique() + .HasDatabaseName("ix_push_subscriptions_account_id_device_id_deleted_at"); + + b.ToTable("push_subscriptions", (string)null); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DysonNetwork.Pusher/Migrations/20250724065831_UpdateDatabaseSomehow.cs b/DysonNetwork.Pusher/Migrations/20250724065831_UpdateDatabaseSomehow.cs new file mode 100644 index 0000000..c2c9acd --- /dev/null +++ b/DysonNetwork.Pusher/Migrations/20250724065831_UpdateDatabaseSomehow.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DysonNetwork.Pusher.Migrations +{ + /// + public partial class UpdateDatabaseSomehow : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn>( + name: "meta", + table: "notifications", + type: "jsonb", + nullable: false, + oldClrType: typeof(Dictionary), + oldType: "jsonb", + oldNullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn>( + name: "meta", + table: "notifications", + type: "jsonb", + nullable: true, + oldClrType: typeof(Dictionary), + oldType: "jsonb"); + } + } +} diff --git a/DysonNetwork.Pusher/Migrations/AppDatabaseModelSnapshot.cs b/DysonNetwork.Pusher/Migrations/AppDatabaseModelSnapshot.cs index bc4142b..55dfdcd 100644 --- a/DysonNetwork.Pusher/Migrations/AppDatabaseModelSnapshot.cs +++ b/DysonNetwork.Pusher/Migrations/AppDatabaseModelSnapshot.cs @@ -49,6 +49,7 @@ namespace DysonNetwork.Pusher.Migrations .HasColumnName("deleted_at"); b.Property>("Meta") + .IsRequired() .HasColumnType("jsonb") .HasColumnName("meta");