1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-06 19:28:08 +01:00

feat(NewDeviceVerification) : database migration scripts for VerifyDevices column in [dbo].[User].

This commit is contained in:
Ike Kottlowski 2024-12-18 20:08:39 -08:00
parent eb9a061e6f
commit 826e7a1906
No known key found for this signature in database
GPG Key ID: C86308E3DCA6D76F
11 changed files with 9091 additions and 0 deletions

View File

@ -72,6 +72,7 @@ public class User : ITableObject<Guid>, IStorableSubscriber, IRevisable, ITwoFac
public DateTime? LastKdfChangeDate { get; set; }
public DateTime? LastKeyRotationDate { get; set; }
public DateTime? LastEmailChangeDate { get; set; }
public bool VerifyDevices { get; set; } = true;
public void SetNewId()
{

View File

@ -0,0 +1,8 @@
IF COL_LENGTH('[dbo].[User]', 'VerifyDevices') IS NULL
BEGIN
ALTER TABLE
[dbo].[User]
ADD
[VerifyDevices] BIT NOT NULL DEFAULT 1
END
GO

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.MySqlMigrations.Migrations
{
/// <inheritdoc />
public partial class AlterUser_AddVerifyDevice : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "VerifyDevices",
table: "User",
type: "tinyint(1)",
nullable: false,
defaultValue: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "VerifyDevices",
table: "User");
}
}
}

View File

@ -1662,6 +1662,9 @@ namespace Bit.MySqlMigrations.Migrations
b.Property<bool>("UsesKeyConnector")
.HasColumnType("tinyint(1)");
b.Property<bool>("VerifyDevices")
.HasColumnType("tinyint(1)");
b.HasKey("Id");
b.HasIndex("Email")

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations
{
/// <inheritdoc />
public partial class AlterUser_AddVerifyDevice : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "VerifyDevices",
table: "User",
type: "boolean",
nullable: false,
defaultValue: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "VerifyDevices",
table: "User");
}
}
}

View File

@ -1668,6 +1668,9 @@ namespace Bit.PostgresMigrations.Migrations
b.Property<bool>("UsesKeyConnector")
.HasColumnType("boolean");
b.Property<bool>("VerifyDevices")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("Email")

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.SqliteMigrations.Migrations
{
/// <inheritdoc />
public partial class AlterUser_AddVerifyDevice : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "VerifyDevices",
table: "User",
type: "INTEGER",
nullable: false,
defaultValue: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "VerifyDevices",
table: "User");
}
}
}

View File

@ -1651,6 +1651,9 @@ namespace Bit.SqliteMigrations.Migrations
b.Property<bool>("UsesKeyConnector")
.HasColumnType("INTEGER");
b.Property<bool>("VerifyDevices")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Email")