using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Bit.PostgresMigrations.Migrations; public partial class PasswordlessAuthRequests : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "RevisionDate", table: "User", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RenewalReminderDate", table: "User", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "PremiumExpirationDate", table: "User", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "LastFailedLoginDate", table: "User", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "CreationDate", table: "User", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "AccountRevisionDate", table: "User", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Transaction", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "SsoUser", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "SsoConfig", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "SsoConfig", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Send", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "ExpirationDate", table: "Send", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "DeletionDate", table: "Send", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Send", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "ProviderUser", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "ProviderUser", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "ProviderOrganization", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "ProviderOrganization", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Provider", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Provider", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Policy", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Policy", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "OrganizationUser", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "OrganizationUser", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "ValidUntil", table: "OrganizationSponsorship", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "LastSyncDate", table: "OrganizationSponsorship", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "RevisionDate", table: "OrganizationApiKey", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Organization", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "OwnersNotifiedOfAutoscaling", table: "Organization", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "ExpirationDate", table: "Organization", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "CreationDate", table: "Organization", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Installation", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Group", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Group", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "ExpirationDate", table: "Grant", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "CreationDate", table: "Grant", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "ConsumedDate", table: "Grant", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Folder", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Folder", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "Date", table: "Event", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "EmergencyAccess", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RecoveryInitiatedDate", table: "EmergencyAccess", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "LastNotificationDate", table: "EmergencyAccess", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "CreationDate", table: "EmergencyAccess", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Device", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Device", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Collection", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Collection", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Cipher", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "DeletedDate", table: "Cipher", type: "timestamp with time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "CreationDate", table: "Cipher", type: "timestamp with time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.CreateTable( name: "AuthRequest", columns: table => new { Id = table.Column(type: "uuid", nullable: false), UserId = table.Column(type: "uuid", nullable: false), Type = table.Column(type: "smallint", nullable: false), RequestDeviceIdentifier = table.Column(type: "text", nullable: true), RequestDeviceType = table.Column(type: "smallint", nullable: false), RequestIpAddress = table.Column(type: "text", nullable: true), RequestFingerprint = table.Column(type: "text", nullable: true), ResponseDeviceId = table.Column(type: "uuid", nullable: true), AccessCode = table.Column(type: "text", nullable: true), PublicKey = table.Column(type: "text", nullable: true), Key = table.Column(type: "text", nullable: true), MasterPasswordHash = table.Column(type: "text", nullable: true), CreationDate = table.Column(type: "timestamp with time zone", nullable: false), ResponseDate = table.Column(type: "timestamp with time zone", nullable: true), AuthenticationDate = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_AuthRequest", x => x.Id); table.ForeignKey( name: "FK_AuthRequest_Device_ResponseDeviceId", column: x => x.ResponseDeviceId, principalTable: "Device", principalColumn: "Id"); table.ForeignKey( name: "FK_AuthRequest_User_UserId", column: x => x.UserId, principalTable: "User", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_AuthRequest_ResponseDeviceId", table: "AuthRequest", column: "ResponseDeviceId"); migrationBuilder.CreateIndex( name: "IX_AuthRequest_UserId", table: "AuthRequest", column: "UserId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AuthRequest"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "User", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RenewalReminderDate", table: "User", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "PremiumExpirationDate", table: "User", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "LastFailedLoginDate", table: "User", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "CreationDate", table: "User", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "AccountRevisionDate", table: "User", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Transaction", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "SsoUser", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "SsoConfig", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "SsoConfig", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Send", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "ExpirationDate", table: "Send", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "DeletionDate", table: "Send", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Send", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "ProviderUser", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "ProviderUser", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "ProviderOrganization", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "ProviderOrganization", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Provider", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Provider", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Policy", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Policy", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "OrganizationUser", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "OrganizationUser", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "ValidUntil", table: "OrganizationSponsorship", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "LastSyncDate", table: "OrganizationSponsorship", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "RevisionDate", table: "OrganizationApiKey", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Organization", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "OwnersNotifiedOfAutoscaling", table: "Organization", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "ExpirationDate", table: "Organization", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "CreationDate", table: "Organization", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Installation", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Group", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Group", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "ExpirationDate", table: "Grant", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "CreationDate", table: "Grant", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "ConsumedDate", table: "Grant", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Folder", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Folder", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "Date", table: "Event", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "EmergencyAccess", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RecoveryInitiatedDate", table: "EmergencyAccess", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "LastNotificationDate", table: "EmergencyAccess", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "CreationDate", table: "EmergencyAccess", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Device", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Device", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Collection", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "CreationDate", table: "Collection", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "RevisionDate", table: "Cipher", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); migrationBuilder.AlterColumn( name: "DeletedDate", table: "Cipher", type: "timestamp without time zone", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp with time zone", oldNullable: true); migrationBuilder.AlterColumn( name: "CreationDate", table: "Cipher", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldType: "timestamp with time zone"); } }