// <auto-generated />
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace AliasServerDb.Migrations
{
    /// <inheritdoc />
    public partial class AddVaultEncryptionSettings : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "EncryptionSettings",
                table: "Vaults",
                type: "TEXT",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<string>(
                name: "EncryptionType",
                table: "Vaults",
                type: "TEXT",
                nullable: false,
                defaultValue: "");

            // Set default values for existing records.
            migrationBuilder.Sql(@"
                UPDATE Vaults
                SET EncryptionType = 'Argon2Id',
                    EncryptionSettings = '{""DegreeOfParallelism"":4,""MemorySize"":8192,""Iterations"":1}'
                WHERE EncryptionType = ''");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "EncryptionSettings",
                table: "Vaults");

            migrationBuilder.DropColumn(
                name: "EncryptionType",
                table: "Vaults");
        }
    }
}
