1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 08:32: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

@ -5,13 +5,14 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Bit.SqliteMigrations.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20231219154710_FCAccessAllCollectionGroups")]
[Migration("20240112123248_FCAccessAllCollectionGroups")]
partial class FCAccessAllCollectionGroups
{
/// <inheritdoc />
@ -66,6 +67,9 @@ namespace Bit.SqliteMigrations.Migrations
b.Property<DateTime?>("ExpirationDate")
.HasColumnType("TEXT");
b.Property<bool>("FlexibleCollections")
.HasColumnType("INTEGER");
b.Property<byte?>("Gateway")
.HasColumnType("INTEGER");
@ -201,6 +205,9 @@ namespace Bit.SqliteMigrations.Migrations
b.HasKey("Id");
b.HasIndex("Id", "Enabled")
.HasAnnotation("Npgsql:IndexInclude", new[] { "UseTotp" });
b.ToTable("Organization", (string)null);
});
@ -229,7 +236,12 @@ namespace Bit.SqliteMigrations.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);
});
@ -476,11 +488,13 @@ namespace Bit.SqliteMigrations.Migrations
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.Grant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
@ -491,6 +505,7 @@ namespace Bit.SqliteMigrations.Migrations
.HasColumnType("TEXT");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Description")
@ -500,6 +515,11 @@ namespace Bit.SqliteMigrations.Migrations
b.Property<DateTime?>("ExpirationDate")
.HasColumnType("TEXT");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("TEXT");
@ -509,10 +529,15 @@ namespace Bit.SqliteMigrations.Migrations
.HasColumnType("TEXT");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Key");
b.HasKey("Id")
.HasAnnotation("SqlServer:Clustered", true);
b.HasIndex("Key")
.IsUnique();
b.ToTable("Grant", (string)null);
});
@ -763,7 +788,15 @@ namespace Bit.SqliteMigrations.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);
});
@ -836,6 +869,9 @@ namespace Bit.SqliteMigrations.Migrations
b.HasKey("Id");
b.HasIndex("Date", "OrganizationId", "ActingUserId", "CipherId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("Event", (string)null);
});
@ -1036,6 +1072,9 @@ namespace Bit.SqliteMigrations.Migrations
b.HasIndex("SponsoringOrganizationId");
b.HasIndex("SponsoringOrganizationUserId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("OrganizationSponsorship", (string)null);
});
@ -1087,9 +1126,15 @@ namespace Bit.SqliteMigrations.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);
});
@ -1144,9 +1189,16 @@ namespace Bit.SqliteMigrations.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);
});
@ -1224,7 +1276,11 @@ namespace Bit.SqliteMigrations.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);
});
@ -1374,6 +1430,13 @@ namespace Bit.SqliteMigrations.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.SqliteMigrations.Migrations;
public partial class FCAccessAllCollectionGroups : Migration
{
private const string _accessAllCollectionGroupsScript = "SqliteMigrations.HelperScripts.2023-12-06_00_AccessAllCollectionGroups.sql";
private const string _accessAllCollectionGroupsScript = "SqliteMigrations.HelperScripts.2024-01-12_00_AccessAllCollectionGroups.sql";
protected override void Up(MigrationBuilder migrationBuilder)
{

View File

@ -5,13 +5,14 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Bit.SqliteMigrations.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20231219154737_FCAccessAllCollectionUsers")]
[Migration("20240112123318_FCAccessAllCollectionUsers")]
partial class FCAccessAllCollectionUsers
{
/// <inheritdoc />
@ -66,6 +67,9 @@ namespace Bit.SqliteMigrations.Migrations
b.Property<DateTime?>("ExpirationDate")
.HasColumnType("TEXT");
b.Property<bool>("FlexibleCollections")
.HasColumnType("INTEGER");
b.Property<byte?>("Gateway")
.HasColumnType("INTEGER");
@ -201,6 +205,9 @@ namespace Bit.SqliteMigrations.Migrations
b.HasKey("Id");
b.HasIndex("Id", "Enabled")
.HasAnnotation("Npgsql:IndexInclude", new[] { "UseTotp" });
b.ToTable("Organization", (string)null);
});
@ -229,7 +236,12 @@ namespace Bit.SqliteMigrations.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);
});
@ -476,11 +488,13 @@ namespace Bit.SqliteMigrations.Migrations
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.Grant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
@ -491,6 +505,7 @@ namespace Bit.SqliteMigrations.Migrations
.HasColumnType("TEXT");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Description")
@ -500,6 +515,11 @@ namespace Bit.SqliteMigrations.Migrations
b.Property<DateTime?>("ExpirationDate")
.HasColumnType("TEXT");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("TEXT");
@ -509,10 +529,15 @@ namespace Bit.SqliteMigrations.Migrations
.HasColumnType("TEXT");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Key");
b.HasKey("Id")
.HasAnnotation("SqlServer:Clustered", true);
b.HasIndex("Key")
.IsUnique();
b.ToTable("Grant", (string)null);
});
@ -763,7 +788,15 @@ namespace Bit.SqliteMigrations.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);
});
@ -836,6 +869,9 @@ namespace Bit.SqliteMigrations.Migrations
b.HasKey("Id");
b.HasIndex("Date", "OrganizationId", "ActingUserId", "CipherId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("Event", (string)null);
});
@ -1036,6 +1072,9 @@ namespace Bit.SqliteMigrations.Migrations
b.HasIndex("SponsoringOrganizationId");
b.HasIndex("SponsoringOrganizationUserId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("OrganizationSponsorship", (string)null);
});
@ -1087,9 +1126,15 @@ namespace Bit.SqliteMigrations.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);
});
@ -1144,9 +1189,16 @@ namespace Bit.SqliteMigrations.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);
});
@ -1224,7 +1276,11 @@ namespace Bit.SqliteMigrations.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);
});
@ -1374,6 +1430,13 @@ namespace Bit.SqliteMigrations.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.SqliteMigrations.Migrations;
public partial class FCAccessAllCollectionUsers : Migration
{
private const string _accessAllCollectionUsersScript = "SqliteMigrations.HelperScripts.2023-12-06_01_AccessAllCollectionUsers.sql";
private const string _accessAllCollectionUsersScript = "SqliteMigrations.HelperScripts.2024-01-12_01_AccessAllCollectionUsers.sql";
protected override void Up(MigrationBuilder migrationBuilder)
{

View File

@ -5,13 +5,14 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Bit.SqliteMigrations.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20231219154820_FCManagersEditAssignedCollectionUsers")]
[Migration("20240112123335_FCManagersEditAssignedCollectionUsers")]
partial class FCManagersEditAssignedCollectionUsers
{
/// <inheritdoc />
@ -66,6 +67,9 @@ namespace Bit.SqliteMigrations.Migrations
b.Property<DateTime?>("ExpirationDate")
.HasColumnType("TEXT");
b.Property<bool>("FlexibleCollections")
.HasColumnType("INTEGER");
b.Property<byte?>("Gateway")
.HasColumnType("INTEGER");
@ -201,6 +205,9 @@ namespace Bit.SqliteMigrations.Migrations
b.HasKey("Id");
b.HasIndex("Id", "Enabled")
.HasAnnotation("Npgsql:IndexInclude", new[] { "UseTotp" });
b.ToTable("Organization", (string)null);
});
@ -229,7 +236,12 @@ namespace Bit.SqliteMigrations.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);
});
@ -476,11 +488,13 @@ namespace Bit.SqliteMigrations.Migrations
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.Grant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
@ -491,6 +505,7 @@ namespace Bit.SqliteMigrations.Migrations
.HasColumnType("TEXT");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Description")
@ -500,6 +515,11 @@ namespace Bit.SqliteMigrations.Migrations
b.Property<DateTime?>("ExpirationDate")
.HasColumnType("TEXT");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("TEXT");
@ -509,10 +529,15 @@ namespace Bit.SqliteMigrations.Migrations
.HasColumnType("TEXT");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Key");
b.HasKey("Id")
.HasAnnotation("SqlServer:Clustered", true);
b.HasIndex("Key")
.IsUnique();
b.ToTable("Grant", (string)null);
});
@ -763,7 +788,15 @@ namespace Bit.SqliteMigrations.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);
});
@ -836,6 +869,9 @@ namespace Bit.SqliteMigrations.Migrations
b.HasKey("Id");
b.HasIndex("Date", "OrganizationId", "ActingUserId", "CipherId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("Event", (string)null);
});
@ -1036,6 +1072,9 @@ namespace Bit.SqliteMigrations.Migrations
b.HasIndex("SponsoringOrganizationId");
b.HasIndex("SponsoringOrganizationUserId")
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("OrganizationSponsorship", (string)null);
});
@ -1087,9 +1126,15 @@ namespace Bit.SqliteMigrations.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);
});
@ -1144,9 +1189,16 @@ namespace Bit.SqliteMigrations.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);
});
@ -1224,7 +1276,11 @@ namespace Bit.SqliteMigrations.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);
});
@ -1374,6 +1430,13 @@ namespace Bit.SqliteMigrations.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.SqliteMigrations.Migrations;
public partial class FCManagersEditAssignedCollectionUsers : Migration
{
private const string _managersEditAssignedCollectionUsersScript = "SqliteMigrations.HelperScripts.2023-12-06_02_ManagersEditAssignedCollectionUsers.sql";
private const string _managersEditAssignedCollectionUsersScript = "SqliteMigrations.HelperScripts.2024-01-12_02_ManagersEditAssignedCollectionUsers.sql";
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.SqliteMigrations.Migrations;
public partial class FCEnableOrgsFlexibleCollections : Migration
{
private const string _enableOrgsFlexibleCollectionsScript = "SqliteMigrations.HelperScripts.2024-01-12_03_EnableOrgsFlexibleCollections.sql";
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(CoreHelpers.GetEmbeddedResourceContentsAsync(_enableOrgsFlexibleCollectionsScript));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
throw new Exception("Irreversible migration");
}
}

View File

@ -23,9 +23,10 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="HelperScripts\2023-12-06_00_AccessAllCollectionGroups.sql" />
<EmbeddedResource Include="HelperScripts\2023-12-06_01_AccessAllCollectionUsers.sql" />
<EmbeddedResource Include="HelperScripts\2023-12-06_02_ManagersEditAssignedCollectionUsers.sql" />
<EmbeddedResource Include="HelperScripts\2024-01-12_00_AccessAllCollectionGroups.sql" />
<EmbeddedResource Include="HelperScripts\2024-01-12_01_AccessAllCollectionUsers.sql" />
<EmbeddedResource Include="HelperScripts\2024-01-12_02_ManagersEditAssignedCollectionUsers.sql" />
<EmbeddedResource Include="HelperScripts\2024-01-12_03_EnableOrgsFlexibleCollections.sql" />
</ItemGroup>
</Project>