using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace GameList.Data.Migrations { /// public partial class AddOwnerRole : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "IsOwner", table: "Players", type: "INTEGER", nullable: false, defaultValue: false); migrationBuilder.Sql( """ UPDATE Players SET IsOwner = 1 WHERE Id = ( SELECT Id FROM Players WHERE IsAdmin = 1 ORDER BY CreatedAt, Id LIMIT 1 ); """); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "IsOwner", table: "Players"); } } }