74 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Microsoft.EntityFrameworkCore.Migrations;
 | |
| using NodaTime;
 | |
| 
 | |
| #nullable disable
 | |
| 
 | |
| namespace DysonNetwork.Ring.Migrations
 | |
| {
 | |
|     /// <inheritdoc />
 | |
|     public partial class InitialMigration : Migration
 | |
|     {
 | |
|         /// <inheritdoc />
 | |
|         protected override void Up(MigrationBuilder migrationBuilder)
 | |
|         {
 | |
|             migrationBuilder.CreateTable(
 | |
|                 name: "notifications",
 | |
|                 columns: table => new
 | |
|                 {
 | |
|                     id = table.Column<Guid>(type: "uuid", nullable: false),
 | |
|                     topic = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
 | |
|                     title = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
 | |
|                     subtitle = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
 | |
|                     content = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
 | |
|                     meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
 | |
|                     priority = table.Column<int>(type: "integer", nullable: false),
 | |
|                     viewed_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | |
|                     account_id = table.Column<Guid>(type: "uuid", nullable: false),
 | |
|                     created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | |
|                     updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | |
|                     deleted_at = table.Column<Instant>(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<Guid>(type: "uuid", nullable: false),
 | |
|                     account_id = table.Column<Guid>(type: "uuid", nullable: false),
 | |
|                     device_id = table.Column<string>(type: "character varying(8192)", maxLength: 8192, nullable: false),
 | |
|                     device_token = table.Column<string>(type: "character varying(8192)", maxLength: 8192, nullable: false),
 | |
|                     provider = table.Column<int>(type: "integer", nullable: false),
 | |
|                     count_delivered = table.Column<int>(type: "integer", nullable: false),
 | |
|                     last_used_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | |
|                     created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | |
|                     updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | |
|                     deleted_at = table.Column<Instant>(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);
 | |
|         }
 | |
| 
 | |
|         /// <inheritdoc />
 | |
|         protected override void Down(MigrationBuilder migrationBuilder)
 | |
|         {
 | |
|             migrationBuilder.DropTable(
 | |
|                 name: "notifications");
 | |
| 
 | |
|             migrationBuilder.DropTable(
 | |
|                 name: "push_subscriptions");
 | |
|         }
 | |
|     }
 | |
| }
 |