1
0
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

# Conflicts:
#	src/Sql/dbo/Stored Procedures/Organization_EnableCollectionEnhancements.sql
#	util/SqliteMigrations/SqliteMigrations.csproj
This commit is contained in:
Rui Tome
2024-02-16 12:47:39 +00:00
382 changed files with 22664 additions and 5025 deletions

View File

@ -72,7 +72,22 @@ public partial class GrantIdWithIndexes : Migration
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.Sql("ALTER TABLE `Grant` ADD COLUMN `Id` INT AUTO_INCREMENT UNIQUE;");
migrationBuilder.Sql(@"
DROP PROCEDURE IF EXISTS GrantSchemaChange;
CREATE PROCEDURE GrantSchemaChange()
BEGIN
IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Grant' AND COLUMN_NAME = 'Id') THEN
ALTER TABLE `Grant` DROP COLUMN `Id`;
END IF;
ALTER TABLE `Grant` ADD COLUMN `Id` INT AUTO_INCREMENT UNIQUE;
END;
CALL GrantSchemaChange();
DROP PROCEDURE GrantSchemaChange;"
);
migrationBuilder.AddPrimaryKey(
name: "PK_Grant",

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.MySqlMigrations.Migrations;
/// <inheritdoc />
public partial class AddAuthTableIndexes : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_SsoUser_OrganizationId_ExternalId",
table: "SsoUser",
columns: new[] { "OrganizationId", "ExternalId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SsoUser_OrganizationId_UserId",
table: "SsoUser",
columns: new[] { "OrganizationId", "UserId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Grant_ExpirationDate",
table: "Grant",
column: "ExpirationDate");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_SsoUser_OrganizationId_ExternalId",
table: "SsoUser");
migrationBuilder.DropIndex(
name: "IX_SsoUser_OrganizationId_UserId",
table: "SsoUser");
migrationBuilder.DropIndex(
name: "IX_Grant_ExpirationDate",
table: "Grant");
}
}

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -3,8 +3,8 @@ using System;
using Bit.Infrastructure.EntityFramework.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
@ -17,7 +17,7 @@ namespace Bit.MySqlMigrations.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.14")
.HasAnnotation("ProductVersion", "7.0.15")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", b =>
@ -136,9 +136,6 @@ namespace Bit.MySqlMigrations.Migrations
b.Property<int?>("Seats")
.HasColumnType("int");
b.Property<bool>("SecretsManagerBeta")
.HasColumnType("tinyint(1)");
b.Property<bool>("SelfHost")
.HasColumnType("tinyint(1)");
@ -490,7 +487,7 @@ namespace Bit.MySqlMigrations.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ClientId")
.IsRequired()
@ -533,8 +530,12 @@ namespace Bit.MySqlMigrations.Migrations
.HasColumnType("varchar(50)");
b.HasKey("Id")
.HasName("PK_Grant")
.HasAnnotation("SqlServer:Clustered", true);
b.HasIndex("ExpirationDate")
.HasAnnotation("SqlServer:Clustered", false);
b.HasIndex("Key")
.IsUnique();
@ -590,10 +591,20 @@ namespace Bit.MySqlMigrations.Migrations
b.HasKey("Id");
b.HasIndex("OrganizationId");
b.HasIndex("OrganizationId")
.HasAnnotation("SqlServer:Clustered", false);
b.HasIndex("UserId");
b.HasIndex("OrganizationId", "ExternalId")
.IsUnique()
.HasAnnotation("Npgsql:IndexInclude", new[] { "UserId" })
.HasAnnotation("SqlServer:Clustered", false);
b.HasIndex("OrganizationId", "UserId")
.IsUnique()
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("SsoUser", (string)null);
});

View File

@ -10,7 +10,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.14">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.15">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>