1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

added webauthncredential ef migrations (#3555)

This commit is contained in:
Ike 2023-12-13 07:03:42 -08:00 committed by GitHub
parent e73e5f7ab4
commit 8bf798a79f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 8622 additions and 1267 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,63 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.MySqlMigrations.Migrations;
/// <inheritdoc />
public partial class WebAuthnLoginCredentials : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "WebAuthnCredential",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
UserId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
PublicKey = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CredentialId = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Counter = table.Column<int>(type: "int", nullable: false),
Type = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
AaGuid = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
EncryptedUserKey = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EncryptedPrivateKey = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EncryptedPublicKey = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
SupportsPrf = table.Column<bool>(type: "tinyint(1)", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
RevisionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WebAuthnCredential", x => x.Id);
table.ForeignKey(
name: "FK_WebAuthnCredential_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_WebAuthnCredential_UserId",
table: "WebAuthnCredential",
column: "UserId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "WebAuthnCredential");
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
/// <inheritdoc />
public partial class WebAuthnLoginCredentials : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "WebAuthnCredential",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
PublicKey = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
CredentialId = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
Counter = table.Column<int>(type: "integer", nullable: false),
Type = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true),
AaGuid = table.Column<Guid>(type: "uuid", nullable: false),
EncryptedUserKey = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
EncryptedPrivateKey = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
EncryptedPublicKey = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
SupportsPrf = table.Column<bool>(type: "boolean", nullable: false),
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
RevisionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WebAuthnCredential", x => x.Id);
table.ForeignKey(
name: "FK_WebAuthnCredential_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_WebAuthnCredential_UserId",
table: "WebAuthnCredential",
column: "UserId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "WebAuthnCredential");
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.SqliteMigrations.Migrations;
/// <inheritdoc />
public partial class WebAuthnLoginCredentials : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "WebAuthnCredential",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
UserId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
PublicKey = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
CredentialId = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
Counter = table.Column<int>(type: "INTEGER", nullable: false),
Type = table.Column<string>(type: "TEXT", maxLength: 20, nullable: true),
AaGuid = table.Column<Guid>(type: "TEXT", nullable: false),
EncryptedUserKey = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: true),
EncryptedPrivateKey = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: true),
EncryptedPublicKey = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: true),
SupportsPrf = table.Column<bool>(type: "INTEGER", nullable: false),
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false),
RevisionDate = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WebAuthnCredential", x => x.Id);
table.ForeignKey(
name: "FK_WebAuthnCredential_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_WebAuthnCredential_UserId",
table: "WebAuthnCredential",
column: "UserId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "WebAuthnCredential");
}
}