50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace JobTrackerApi.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddAiPrivacyPreferences : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
if (ActiveProvider.Contains("MySql", System.StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
migrationBuilder.Sql("ALTER TABLE `AspNetUsers` ADD COLUMN `AiEnabled` tinyint(1) NOT NULL DEFAULT 1;");
|
|
migrationBuilder.Sql("ALTER TABLE `AspNetUsers` ADD COLUMN `ExternalAiProcessingAllowed` tinyint(1) NOT NULL DEFAULT 0;");
|
|
}
|
|
else
|
|
{
|
|
// Preserve existing AI behaviour while external processing remains opt-in.
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "AiEnabled",
|
|
table: "AspNetUsers",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: true);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "ExternalAiProcessingAllowed",
|
|
table: "AspNetUsers",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "AiEnabled",
|
|
table: "AspNetUsers");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ExternalAiProcessingAllowed",
|
|
table: "AspNetUsers");
|
|
}
|
|
}
|
|
}
|