mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 23:18:56 -07:00
39 lines
1.6 KiB
C#
39 lines
1.6 KiB
C#
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using RadicadeServer.DB;
|
|
|
|
#nullable disable
|
|
|
|
namespace RadicadeServer.Migrations;
|
|
|
|
[DbContext(typeof(RecDBContext))]
|
|
[Migration("20260919120000_AddProfileBannerAndRecentHistoryVisibility")]
|
|
public partial class AddProfileBannerAndRecentHistoryVisibility : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.Sql(@"
|
|
-- Nullable: an account that has never picked a banner has none, and the client
|
|
-- renders that as an empty banner area rather than a broken image.
|
|
IF COL_LENGTH('dbo.Profiles', 'bannerImage') IS NULL
|
|
ALTER TABLE [Profiles] ADD [bannerImage] nvarchar(max) NULL;
|
|
|
|
-- Default true so every existing account keeps the visibility the privacy object
|
|
-- already reported for it (this server shows profiles to everyone).
|
|
IF COL_LENGTH('dbo.Profiles', 'isRecentHistoryVisible') IS NULL
|
|
ALTER TABLE [Profiles] ADD [isRecentHistoryVisible] bit NOT NULL
|
|
CONSTRAINT [DF_Profiles_isRecentHistoryVisible] DEFAULT 1;");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.Sql(@"
|
|
IF OBJECT_ID('DF_Profiles_isRecentHistoryVisible', 'D') IS NOT NULL
|
|
ALTER TABLE [Profiles] DROP CONSTRAINT [DF_Profiles_isRecentHistoryVisible];
|
|
IF COL_LENGTH('dbo.Profiles', 'isRecentHistoryVisible') IS NOT NULL
|
|
ALTER TABLE [Profiles] DROP COLUMN [isRecentHistoryVisible];
|
|
IF COL_LENGTH('dbo.Profiles', 'bannerImage') IS NOT NULL
|
|
ALTER TABLE [Profiles] DROP COLUMN [bannerImage];");
|
|
}
|
|
}
|