using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace API.Data.Migrations { public partial class SiteTheme : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "SiteDarkMode", table: "AppUserPreferences"); migrationBuilder.AddColumn( name: "ThemeId", table: "AppUserPreferences", type: "INTEGER", nullable: true); migrationBuilder.CreateTable( name: "SiteTheme", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: true), NormalizedName = table.Column(type: "TEXT", nullable: true), FileName = table.Column(type: "TEXT", nullable: true), IsDefault = table.Column(type: "INTEGER", nullable: false), Provider = table.Column(type: "INTEGER", nullable: false), Created = table.Column(type: "TEXT", nullable: false), LastModified = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SiteTheme", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_AppUserPreferences_ThemeId", table: "AppUserPreferences", column: "ThemeId"); migrationBuilder.AddForeignKey( name: "FK_AppUserPreferences_SiteTheme_ThemeId", table: "AppUserPreferences", column: "ThemeId", principalTable: "SiteTheme", principalColumn: "Id"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_AppUserPreferences_SiteTheme_ThemeId", table: "AppUserPreferences"); migrationBuilder.DropTable( name: "SiteTheme"); migrationBuilder.DropIndex( name: "IX_AppUserPreferences_ThemeId", table: "AppUserPreferences"); migrationBuilder.DropColumn( name: "ThemeId", table: "AppUserPreferences"); migrationBuilder.AddColumn( name: "SiteDarkMode", table: "AppUserPreferences", type: "INTEGER", nullable: false, defaultValue: false); } } }