mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
Merge branch 'main' into ac/ac-1682/ef-migrations
This commit is contained in:
2334
util/MySqlMigrations/Migrations/20231214162533_GrantIdWithIndexes.Designer.cs
generated
Normal file
2334
util/MySqlMigrations/Migrations/20231214162533_GrantIdWithIndexes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,143 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.MySqlMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class GrantIdWithIndexes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Grant",
|
||||
table: "Grant");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Grant",
|
||||
keyColumn: "Type",
|
||||
keyValue: null,
|
||||
column: "Type",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Type",
|
||||
table: "Grant",
|
||||
type: "varchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(50)",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Grant",
|
||||
keyColumn: "Data",
|
||||
keyValue: null,
|
||||
column: "Data",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Data",
|
||||
table: "Grant",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Grant",
|
||||
keyColumn: "ClientId",
|
||||
keyValue: null,
|
||||
column: "ClientId",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ClientId",
|
||||
table: "Grant",
|
||||
type: "varchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(200)",
|
||||
oldMaxLength: 200,
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.Sql("ALTER TABLE `Grant` ADD COLUMN `Id` INT AUTO_INCREMENT UNIQUE;");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Grant",
|
||||
table: "Grant",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Grant_Key",
|
||||
table: "Grant",
|
||||
column: "Key",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Grant",
|
||||
table: "Grant");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Grant_Key",
|
||||
table: "Grant");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Id",
|
||||
table: "Grant");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Type",
|
||||
table: "Grant",
|
||||
type: "varchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(50)",
|
||||
oldMaxLength: 50)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Data",
|
||||
table: "Grant",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ClientId",
|
||||
table: "Grant",
|
||||
type: "varchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(200)",
|
||||
oldMaxLength: 200)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Grant",
|
||||
table: "Grant",
|
||||
column: "Key");
|
||||
}
|
||||
}
|
2341
util/MySqlMigrations/Migrations/20231229202309_AddToolsTableIndexes.Designer.cs
generated
Normal file
2341
util/MySqlMigrations/Migrations/20231229202309_AddToolsTableIndexes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.MySqlMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddToolsTableIndexes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Send_DeletionDate",
|
||||
table: "Send",
|
||||
column: "DeletionDate");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Send_UserId_OrganizationId",
|
||||
table: "Send",
|
||||
columns: new[] { "UserId", "OrganizationId" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Send_DeletionDate",
|
||||
table: "Send");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Send_UserId_OrganizationId",
|
||||
table: "Send");
|
||||
}
|
||||
}
|
2380
util/MySqlMigrations/Migrations/20240109215348_AddTableIndexes.Designer.cs
generated
Normal file
2380
util/MySqlMigrations/Migrations/20240109215348_AddTableIndexes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,110 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.MySqlMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddTableIndexes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_User_Email",
|
||||
table: "User",
|
||||
column: "Email",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_User_Premium_PremiumExpirationDate_RenewalReminderDate",
|
||||
table: "User",
|
||||
columns: new[] { "Premium", "PremiumExpirationDate", "RenewalReminderDate" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Transaction_UserId_OrganizationId_CreationDate",
|
||||
table: "Transaction",
|
||||
columns: new[] { "UserId", "OrganizationId", "CreationDate" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Policy_OrganizationId_Type",
|
||||
table: "Policy",
|
||||
columns: new[] { "OrganizationId", "Type" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrganizationUser_UserId_OrganizationId_Status",
|
||||
table: "OrganizationUser",
|
||||
columns: new[] { "UserId", "OrganizationId", "Status" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrganizationSponsorship_SponsoringOrganizationUserId",
|
||||
table: "OrganizationSponsorship",
|
||||
column: "SponsoringOrganizationUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Organization_Id_Enabled",
|
||||
table: "Organization",
|
||||
columns: new[] { "Id", "Enabled" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Event_Date_OrganizationId_ActingUserId_CipherId",
|
||||
table: "Event",
|
||||
columns: new[] { "Date", "OrganizationId", "ActingUserId", "CipherId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Device_Identifier",
|
||||
table: "Device",
|
||||
column: "Identifier");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Device_UserId_Identifier",
|
||||
table: "Device",
|
||||
columns: new[] { "UserId", "Identifier" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_User_Email",
|
||||
table: "User");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_User_Premium_PremiumExpirationDate_RenewalReminderDate",
|
||||
table: "User");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Transaction_UserId_OrganizationId_CreationDate",
|
||||
table: "Transaction");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Policy_OrganizationId_Type",
|
||||
table: "Policy");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_OrganizationUser_UserId_OrganizationId_Status",
|
||||
table: "OrganizationUser");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_OrganizationSponsorship_SponsoringOrganizationUserId",
|
||||
table: "OrganizationSponsorship");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Organization_Id_Enabled",
|
||||
table: "Organization");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Event_Date_OrganizationId_ActingUserId_CipherId",
|
||||
table: "Event");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Device_Identifier",
|
||||
table: "Device");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Device_UserId_Identifier",
|
||||
table: "Device");
|
||||
}
|
||||
}
|
2337
util/MySqlMigrations/Migrations/20240111034851_OrganizationFlexibleCollectionsColumn.Designer.cs
generated
Normal file
2337
util/MySqlMigrations/Migrations/20240111034851_OrganizationFlexibleCollectionsColumn.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.MySqlMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class OrganizationFlexibleCollectionsColumn : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "FlexibleCollections",
|
||||
table: "Organization",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FlexibleCollections",
|
||||
table: "Organization");
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ using System;
|
||||
using Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
@ -65,6 +66,9 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Property<DateTime?>("ExpirationDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("FlexibleCollections")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<byte?>("Gateway")
|
||||
.HasColumnType("tinyint unsigned");
|
||||
|
||||
@ -200,6 +204,9 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id", "Enabled")
|
||||
.HasAnnotation("Npgsql:IndexInclude", new[] { "UseTotp" });
|
||||
|
||||
b.ToTable("Organization", (string)null);
|
||||
});
|
||||
|
||||
@ -228,7 +235,12 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
b.HasIndex("OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("OrganizationId", "Type")
|
||||
.IsUnique()
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Policy", (string)null);
|
||||
});
|
||||
@ -475,11 +487,13 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.Grant", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ClientId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
@ -490,6 +504,7 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Description")
|
||||
@ -499,6 +514,11 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Property<DateTime?>("ExpirationDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("SessionId")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
@ -508,10 +528,15 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.HasKey("Key");
|
||||
b.HasKey("Id")
|
||||
.HasAnnotation("SqlServer:Clustered", true);
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Grant", (string)null);
|
||||
});
|
||||
@ -762,7 +787,15 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("Identifier")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId", "Identifier")
|
||||
.IsUnique()
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Device", (string)null);
|
||||
});
|
||||
@ -835,6 +868,9 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Date", "OrganizationId", "ActingUserId", "CipherId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Event", (string)null);
|
||||
});
|
||||
|
||||
@ -1035,6 +1071,9 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasIndex("SponsoringOrganizationId");
|
||||
|
||||
b.HasIndex("SponsoringOrganizationUserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("OrganizationSponsorship", (string)null);
|
||||
});
|
||||
|
||||
@ -1086,9 +1125,15 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
b.HasIndex("OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("UserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId", "OrganizationId", "Status")
|
||||
.HasAnnotation("Npgsql:IndexInclude", new[] { "AccessAll" })
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("OrganizationUser", (string)null);
|
||||
});
|
||||
@ -1143,9 +1188,16 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DeletionDate")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("UserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId", "OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Send", (string)null);
|
||||
});
|
||||
@ -1223,7 +1275,11 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("UserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId", "OrganizationId", "CreationDate")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Transaction", (string)null);
|
||||
});
|
||||
@ -1373,6 +1429,13 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique()
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("Premium", "PremiumExpirationDate", "RenewalReminderDate")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("User", (string)null);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user