using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Nuuru.Server.Migrations { /// public partial class AddFriendsAndEnemies : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "BlockMentionsFromEnemies", table: "UserSettings", type: "INTEGER", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "NotifyOnEnemyAdded", table: "UserSettings", type: "INTEGER", nullable: false, defaultValue: true); migrationBuilder.AddColumn( name: "NotifyOnFriendAdded", table: "UserSettings", type: "INTEGER", nullable: false, defaultValue: true); migrationBuilder.AddColumn( name: "NotifyOnFriendRemoved", table: "UserSettings", type: "INTEGER", nullable: false, defaultValue: true); migrationBuilder.AddColumn( name: "OnlyAllowDmsFromFriends", table: "UserSettings", type: "INTEGER", nullable: false, defaultValue: false); migrationBuilder.CreateTable( name: "FriendBlocks", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), BlockedUserId = table.Column(type: "TEXT", nullable: false), BlockedByUserId = table.Column(type: "TEXT", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_FriendBlocks", x => x.Id); table.ForeignKey( name: "FK_FriendBlocks_AspNetUsers_BlockedByUserId", column: x => x.BlockedByUserId, principalTable: "AspNetUsers", principalColumn: "Id"); table.ForeignKey( name: "FK_FriendBlocks_AspNetUsers_BlockedUserId", column: x => x.BlockedUserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "RelationCooldowns", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), UserId = table.Column(type: "TEXT", nullable: false), TargetUserId = table.Column(type: "TEXT", nullable: false), LastActionAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_RelationCooldowns", x => x.Id); }); migrationBuilder.CreateTable( name: "UserRelations", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), UserId = table.Column(type: "TEXT", nullable: false), TargetUserId = table.Column(type: "TEXT", nullable: false), Type = table.Column(type: "INTEGER", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserRelations", x => x.Id); table.ForeignKey( name: "FK_UserRelations_AspNetUsers_TargetUserId", column: x => x.TargetUserId, principalTable: "AspNetUsers", principalColumn: "Id"); table.ForeignKey( name: "FK_UserRelations_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_FriendBlocks_BlockedByUserId", table: "FriendBlocks", column: "BlockedByUserId"); migrationBuilder.CreateIndex( name: "IX_FriendBlocks_BlockedUserId_BlockedByUserId", table: "FriendBlocks", columns: new[] { "BlockedUserId", "BlockedByUserId" }, unique: true); migrationBuilder.CreateIndex( name: "IX_RelationCooldowns_UserId_TargetUserId", table: "RelationCooldowns", columns: new[] { "UserId", "TargetUserId" }, unique: true); migrationBuilder.CreateIndex( name: "IX_UserRelations_TargetUserId_Type", table: "UserRelations", columns: new[] { "TargetUserId", "Type" }); migrationBuilder.CreateIndex( name: "IX_UserRelations_UserId_TargetUserId_Type", table: "UserRelations", columns: new[] { "UserId", "TargetUserId", "Type" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "FriendBlocks"); migrationBuilder.DropTable( name: "RelationCooldowns"); migrationBuilder.DropTable( name: "UserRelations"); migrationBuilder.DropColumn( name: "BlockMentionsFromEnemies", table: "UserSettings"); migrationBuilder.DropColumn( name: "NotifyOnEnemyAdded", table: "UserSettings"); migrationBuilder.DropColumn( name: "NotifyOnFriendAdded", table: "UserSettings"); migrationBuilder.DropColumn( name: "NotifyOnFriendRemoved", table: "UserSettings"); migrationBuilder.DropColumn( name: "OnlyAllowDmsFromFriends", table: "UserSettings"); } } }