mirror of
https://github.com/bitwarden/server.git
synced 2024-12-25 17:27:45 +01:00
[SM-195] Enable legacy timestamp for migrations (#2238)
This commit is contained in:
parent
b612426782
commit
6a0e134129
@ -24,6 +24,9 @@ public class DatabaseContextFactory : IDesignTimeDbContextFactory<DatabaseContex
|
||||
var globalSettings = GlobalSettingsFactory.GlobalSettings;
|
||||
var optionsBuilder = new DbContextOptionsBuilder<DatabaseContext>();
|
||||
var connectionString = globalSettings.PostgreSql?.ConnectionString;
|
||||
// NpgSql 6.0 changed how timezones works. We have not yet updated our projects to support this new behavior and need to fallback to the previous behavior.
|
||||
// Check https://www.npgsql.org/doc/release-notes/6.0.html#timestamp-rationalization-and-improvements for more details.
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
if (string.IsNullOrWhiteSpace(connectionString))
|
||||
{
|
||||
throw new Exception("No Postgres connection string found.");
|
||||
|
@ -32,13 +32,13 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime?>("DeletedDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Favorites")
|
||||
.HasColumnType("text");
|
||||
@ -53,7 +53,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<byte>("Type")
|
||||
.HasColumnType("smallint");
|
||||
@ -76,7 +76,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ExternalId")
|
||||
.HasMaxLength(300)
|
||||
@ -89,7 +89,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@ -167,7 +167,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Identifier")
|
||||
.HasMaxLength(50)
|
||||
@ -182,7 +182,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<byte>("Type")
|
||||
.HasColumnType("smallint");
|
||||
@ -203,7 +203,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
@ -219,13 +219,13 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime?>("LastNotificationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime?>("RecoveryInitiatedDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<byte>("Status")
|
||||
.HasColumnType("smallint");
|
||||
@ -260,7 +260,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<byte?>("DeviceType")
|
||||
.HasColumnType("smallint");
|
||||
@ -310,13 +310,13 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
@ -339,10 +339,10 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<DateTime?>("ConsumedDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.HasColumnType("text");
|
||||
@ -352,7 +352,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<DateTime?>("ExpirationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("SessionId")
|
||||
.HasMaxLength(100)
|
||||
@ -380,7 +380,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ExternalId")
|
||||
.HasMaxLength(300)
|
||||
@ -394,7 +394,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@ -429,7 +429,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
@ -481,13 +481,13 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<bool>("Enabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime?>("ExpirationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<byte?>("Gateway")
|
||||
.HasColumnType("smallint");
|
||||
@ -523,7 +523,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<DateTime?>("OwnersNotifiedOfAutoscaling")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Plan")
|
||||
.HasMaxLength(50)
|
||||
@ -542,7 +542,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int?>("Seats")
|
||||
.HasColumnType("integer");
|
||||
@ -610,7 +610,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<byte>("Type")
|
||||
.HasColumnType("smallint");
|
||||
@ -656,7 +656,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<DateTime?>("LastSyncDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("OfferedToEmail")
|
||||
.HasMaxLength(256)
|
||||
@ -678,7 +678,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime?>("ValidUntil")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@ -698,7 +698,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
@ -721,7 +721,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<short>("Status")
|
||||
.HasColumnType("smallint");
|
||||
@ -747,7 +747,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.HasColumnType("text");
|
||||
@ -759,7 +759,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<byte>("Type")
|
||||
.HasColumnType("smallint");
|
||||
@ -798,7 +798,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<bool>("Enabled")
|
||||
.HasColumnType("boolean");
|
||||
@ -807,7 +807,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<byte>("Status")
|
||||
.HasColumnType("smallint");
|
||||
@ -826,7 +826,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
@ -838,7 +838,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Settings")
|
||||
.HasColumnType("text");
|
||||
@ -858,7 +858,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
@ -873,7 +873,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<byte>("Status")
|
||||
.HasColumnType("smallint");
|
||||
@ -902,19 +902,19 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DeletionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<bool>("Disabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime?>("ExpirationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<bool?>("HideEmail")
|
||||
.HasColumnType("boolean");
|
||||
@ -933,7 +933,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("character varying(300)");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<byte>("Type")
|
||||
.HasColumnType("smallint");
|
||||
@ -959,7 +959,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.HasColumnType("text");
|
||||
@ -971,7 +971,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@ -989,7 +989,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ExternalId")
|
||||
.HasMaxLength(50)
|
||||
@ -1049,7 +1049,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Details")
|
||||
.HasMaxLength(100)
|
||||
@ -1095,7 +1095,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("AccountRevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ApiKey")
|
||||
.IsRequired()
|
||||
@ -1103,7 +1103,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("character varying(30)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Culture")
|
||||
.HasMaxLength(10)
|
||||
@ -1151,7 +1151,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime?>("LastFailedLoginDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("LicenseKey")
|
||||
.HasMaxLength(100)
|
||||
@ -1176,7 +1176,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime?>("PremiumExpirationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("PrivateKey")
|
||||
.HasColumnType("text");
|
||||
@ -1188,10 +1188,10 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime?>("RenewalReminderDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.IsRequired()
|
||||
|
Loading…
Reference in New Issue
Block a user