1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 00:22:50 -05:00

[AC-1682] Bumped up the dates on the migration scripts

This commit is contained in:
Rui Tome
2024-01-12 12:54:34 +00:00
parent 5c08d181a4
commit 19fb7e583e
40 changed files with 7988 additions and 145 deletions

View File

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Bit.PostgresMigrations.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20231219154705_FCAccessAllCollectionGroups")]
[Migration("20240112123257_FCAccessAllCollectionGroups")]
partial class FCAccessAllCollectionGroups
{
/// <inheritdoc />
@ -72,6 +72,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");
@ -208,6 +211,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);
});
@ -236,7 +243,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);
});
@ -483,11 +495,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)");
@ -498,6 +513,7 @@ namespace Bit.PostgresMigrations.Migrations
.HasColumnType("timestamp with time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
@ -507,6 +523,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)");
@ -516,10 +537,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);
});
@ -775,7 +801,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);
});
@ -848,6 +882,9 @@ namespace Bit.PostgresMigrations.Migrations
b.HasKey("Id");
b.HasIndex("Date", "OrganizationId", "ActingUserId", "CipherId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("Event", (string)null);
});
@ -1048,6 +1085,9 @@ namespace Bit.PostgresMigrations.Migrations
b.HasIndex("SponsoringOrganizationId");
b.HasIndex("SponsoringOrganizationUserId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("OrganizationSponsorship", (string)null);
});
@ -1099,9 +1139,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);
});
@ -1156,9 +1203,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);
});
@ -1236,7 +1290,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);
});
@ -1387,6 +1445,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);
});

View File

@ -7,7 +7,7 @@ namespace Bit.PostgresMigrations.Migrations;
public partial class FCAccessAllCollectionGroups : Migration
{
private const string _accessAllCollectionGroupsScript = "PostgresMigrations.HelperScripts.2023-12-06_00_AccessAllCollectionGroups.psql";
private const string _accessAllCollectionGroupsScript = "PostgresMigrations.HelperScripts.2024-01-12_00_AccessAllCollectionGroups.psql";
protected override void Up(MigrationBuilder migrationBuilder)
{

View File

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Bit.PostgresMigrations.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20231219154729_FCAccessAllCollectionUsers")]
[Migration("20240112123314_FCAccessAllCollectionUsers")]
partial class FCAccessAllCollectionUsers
{
/// <inheritdoc />
@ -72,6 +72,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");
@ -208,6 +211,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);
});
@ -236,7 +243,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);
});
@ -483,11 +495,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)");
@ -498,6 +513,7 @@ namespace Bit.PostgresMigrations.Migrations
.HasColumnType("timestamp with time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
@ -507,6 +523,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)");
@ -516,10 +537,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);
});
@ -775,7 +801,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);
});
@ -848,6 +882,9 @@ namespace Bit.PostgresMigrations.Migrations
b.HasKey("Id");
b.HasIndex("Date", "OrganizationId", "ActingUserId", "CipherId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("Event", (string)null);
});
@ -1048,6 +1085,9 @@ namespace Bit.PostgresMigrations.Migrations
b.HasIndex("SponsoringOrganizationId");
b.HasIndex("SponsoringOrganizationUserId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("OrganizationSponsorship", (string)null);
});
@ -1099,9 +1139,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);
});
@ -1156,9 +1203,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);
});
@ -1236,7 +1290,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);
});
@ -1387,6 +1445,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);
});

View File

@ -7,7 +7,7 @@ namespace Bit.PostgresMigrations.Migrations;
public partial class FCAccessAllCollectionUsers : Migration
{
private const string _accessAllCollectionUsersScript = "PostgresMigrations.HelperScripts.2023-12-06_01_AccessAllCollectionUsers.psql";
private const string _accessAllCollectionUsersScript = "PostgresMigrations.HelperScripts.2024-01-12_01_AccessAllCollectionUsers.psql";
protected override void Up(MigrationBuilder migrationBuilder)
{

View File

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Bit.PostgresMigrations.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20231219154829_FCManagersEditAssignedCollectionUsers")]
[Migration("20240112123331_FCManagersEditAssignedCollectionUsers")]
partial class FCManagersEditAssignedCollectionUsers
{
/// <inheritdoc />
@ -72,6 +72,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");
@ -208,6 +211,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);
});
@ -236,7 +243,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);
});
@ -483,11 +495,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)");
@ -498,6 +513,7 @@ namespace Bit.PostgresMigrations.Migrations
.HasColumnType("timestamp with time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
@ -507,6 +523,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)");
@ -516,10 +537,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);
});
@ -775,7 +801,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);
});
@ -848,6 +882,9 @@ namespace Bit.PostgresMigrations.Migrations
b.HasKey("Id");
b.HasIndex("Date", "OrganizationId", "ActingUserId", "CipherId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("Event", (string)null);
});
@ -1048,6 +1085,9 @@ namespace Bit.PostgresMigrations.Migrations
b.HasIndex("SponsoringOrganizationId");
b.HasIndex("SponsoringOrganizationUserId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("OrganizationSponsorship", (string)null);
});
@ -1099,9 +1139,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);
});
@ -1156,9 +1203,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);
});
@ -1236,7 +1290,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);
});
@ -1387,6 +1445,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);
});

View File

@ -7,7 +7,7 @@ namespace Bit.PostgresMigrations.Migrations;
public partial class FCManagersEditAssignedCollectionUsers : Migration
{
private const string _managersEditAssignedCollectionUsersScript = "PostgresMigrations.HelperScripts.2023-12-06_02_ManagersEditAssignedCollectionUsers.psql";
private const string _managersEditAssignedCollectionUsersScript = "PostgresMigrations.HelperScripts.2024-01-12_02_ManagersEditAssignedCollectionUsers.psql";
protected override void Up(MigrationBuilder migrationBuilder)
{

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
using Bit.Core.Utilities;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
public partial class FCEnableOrgsFlexibleCollections : Migration
{
private const string _enableOrgsFlexibleCollectionsScript = "PostgresMigrations.HelperScripts.2024-01-12_03_EnableOrgsFlexibleCollections.psql";
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(CoreHelpers.GetEmbeddedResourceContentsAsync(_enableOrgsFlexibleCollectionsScript));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
throw new Exception("Irreversible migration");
}
}