using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Nuuru.Server.Migrations { /// public partial class AddWatchesAndNotificationTypes : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "RelatedForumThreadId", table: "Notifications", type: "INTEGER", nullable: true); migrationBuilder.CreateTable( name: "Watches", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), UserId = table.Column(type: "TEXT", nullable: false), TargetType = table.Column(type: "INTEGER", nullable: false), TargetId = table.Column(type: "INTEGER", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Watches", x => x.Id); table.ForeignKey( name: "FK_Watches_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Watches_TargetType_TargetId", table: "Watches", columns: new[] { "TargetType", "TargetId" }); migrationBuilder.CreateIndex( name: "IX_Watches_UserId_TargetType_TargetId", table: "Watches", columns: new[] { "UserId", "TargetType", "TargetId" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Watches"); migrationBuilder.DropColumn( name: "RelatedForumThreadId", table: "Notifications"); } } }