using JobTrackerApi.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace JobTrackerApi.Migrations; [DbContext(typeof(JobTrackerContext))] [Migration("20261021090000_AddDashboardLayoutPreference")] public partial class AddDashboardLayoutPreference : Migration { protected override void Up(MigrationBuilder migrationBuilder) { var mysql = ActiveProvider.Contains("MySql", StringComparison.OrdinalIgnoreCase); migrationBuilder.AddColumn(name: "DashboardLayoutJson", table: "AspNetUsers", type: mysql ? "longtext" : "TEXT", nullable: true); migrationBuilder.AddColumn(name: "DashboardLayoutRevision", table: "AspNetUsers", type: mysql ? "bigint" : "INTEGER", nullable: false, defaultValue: 0L); } protected override void Down(MigrationBuilder migrationBuilder) { if (ActiveProvider.Contains("Sqlite", StringComparison.OrdinalIgnoreCase)) { // These independent columns need no table rebuild (SQLite 3.35+ supports DROP COLUMN). migrationBuilder.Sql("ALTER TABLE \"AspNetUsers\" DROP COLUMN \"DashboardLayoutJson\";"); migrationBuilder.Sql("ALTER TABLE \"AspNetUsers\" DROP COLUMN \"DashboardLayoutRevision\";"); return; } migrationBuilder.DropColumn(name: "DashboardLayoutJson", table: "AspNetUsers"); migrationBuilder.DropColumn(name: "DashboardLayoutRevision", table: "AspNetUsers"); } }