Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

1.3 KB
Raw Blame
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace AliasServerDb.Migrations
{
    /// <inheritdoc />
    public partial class AddSrpIdentityToUser : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "SrpIdentity",
                table: "AliasVaultUsers",
                type: "character varying(255)",
                maxLength: 255,
                nullable: true);

            // Populate SrpIdentity for existing users using their current username which was
            // used before this migration was applied. All newly registered users will have
            // this field populated with a random GUID generated by the client upon registration.
            migrationBuilder.Sql(@"
                UPDATE ""AliasVaultUsers""
                SET ""SrpIdentity"" = LOWER(""UserName"")
                WHERE ""SrpIdentity"" IS NULL;
            ");
        }

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