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:
2347
util/PostgresMigrations/Migrations/20231214162542_GrantIdWithIndexes.Designer.cs
generated
Normal file
2347
util/PostgresMigrations/Migrations/20231214162542_GrantIdWithIndexes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,120 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.PostgresMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class GrantIdWithIndexes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Grant",
|
||||
table: "Grant");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Type",
|
||||
table: "Grant",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Data",
|
||||
table: "Grant",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ClientId",
|
||||
table: "Grant",
|
||||
type: "character varying(200)",
|
||||
maxLength: 200,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(200)",
|
||||
oldMaxLength: 200,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Id",
|
||||
table: "Grant",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
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: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Data",
|
||||
table: "Grant",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ClientId",
|
||||
table: "Grant",
|
||||
type: "character varying(200)",
|
||||
maxLength: 200,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(200)",
|
||||
oldMaxLength: 200);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Grant",
|
||||
table: "Grant",
|
||||
column: "Key");
|
||||
}
|
||||
}
|
2354
util/PostgresMigrations/Migrations/20231229202259_AddToolsTableIndexes.Designer.cs
generated
Normal file
2354
util/PostgresMigrations/Migrations/20231229202259_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.PostgresMigrations.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");
|
||||
}
|
||||
}
|
2395
util/PostgresMigrations/Migrations/20240109215338_AddTableIndexes.Designer.cs
generated
Normal file
2395
util/PostgresMigrations/Migrations/20240109215338_AddTableIndexes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,112 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.PostgresMigrations.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" })
|
||||
.Annotation("Npgsql:IndexInclude", new[] { "AccessAll" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrganizationSponsorship_SponsoringOrganizationUserId",
|
||||
table: "OrganizationSponsorship",
|
||||
column: "SponsoringOrganizationUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Organization_Id_Enabled",
|
||||
table: "Organization",
|
||||
columns: new[] { "Id", "Enabled" })
|
||||
.Annotation("Npgsql:IndexInclude", new[] { "UseTotp" });
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
2350
util/PostgresMigrations/Migrations/20240111034857_OrganizationFlexibleCollectionsColumn.Designer.cs
generated
Normal file
2350
util/PostgresMigrations/Migrations/20240111034857_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.PostgresMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class OrganizationFlexibleCollectionsColumn : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "FlexibleCollections",
|
||||
table: "Organization",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FlexibleCollections",
|
||||
table: "Organization");
|
||||
}
|
||||
}
|
@ -69,6 +69,9 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.Property<DateTime?>("ExpirationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("FlexibleCollections")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<byte?>("Gateway")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
@ -205,6 +208,10 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id", "Enabled");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("Id", "Enabled"), new[] { "UseTotp" });
|
||||
|
||||
b.ToTable("Organization", (string)null);
|
||||
});
|
||||
|
||||
@ -233,7 +240,12 @@ namespace Bit.PostgresMigrations.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);
|
||||
});
|
||||
@ -480,11 +492,14 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.Grant", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClientId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
@ -495,6 +510,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
@ -504,6 +520,11 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.Property<DateTime?>("ExpirationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<string>("SessionId")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
@ -513,10 +534,15 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.HasKey("Key");
|
||||
b.HasKey("Id")
|
||||
.HasAnnotation("SqlServer:Clustered", true);
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Grant", (string)null);
|
||||
});
|
||||
@ -772,7 +798,15 @@ namespace Bit.PostgresMigrations.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);
|
||||
});
|
||||
@ -845,6 +879,9 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Date", "OrganizationId", "ActingUserId", "CipherId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Event", (string)null);
|
||||
});
|
||||
|
||||
@ -1045,6 +1082,9 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("SponsoringOrganizationId");
|
||||
|
||||
b.HasIndex("SponsoringOrganizationUserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("OrganizationSponsorship", (string)null);
|
||||
});
|
||||
|
||||
@ -1096,9 +1136,16 @@ namespace Bit.PostgresMigrations.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("SqlServer:Clustered", false);
|
||||
|
||||
NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("UserId", "OrganizationId", "Status"), new[] { "AccessAll" });
|
||||
|
||||
b.ToTable("OrganizationUser", (string)null);
|
||||
});
|
||||
@ -1153,9 +1200,16 @@ namespace Bit.PostgresMigrations.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);
|
||||
});
|
||||
@ -1233,7 +1287,11 @@ namespace Bit.PostgresMigrations.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);
|
||||
});
|
||||
@ -1384,6 +1442,13 @@ namespace Bit.PostgresMigrations.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