1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

Revert filescoped (#2227)

* Revert "Add git blame entry (#2226)"

This reverts commit 239286737d.

* Revert "Turn on file scoped namespaces (#2225)"

This reverts commit 34fb4cca2a.
This commit is contained in:
Justin Baur
2022-08-29 15:53:48 -04:00
committed by GitHub
parent 239286737d
commit bae03feffe
1208 changed files with 74317 additions and 73126 deletions

View File

@ -4,33 +4,34 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace MySqlMigrations;
public static class GlobalSettingsFactory
namespace MySqlMigrations
{
public static GlobalSettings GlobalSettings { get; } = new GlobalSettings();
static GlobalSettingsFactory()
public static class GlobalSettingsFactory
{
var configBuilder = new ConfigurationBuilder().AddUserSecrets<Bit.Api.Startup>();
var Configuration = configBuilder.Build();
ConfigurationBinder.Bind(Configuration.GetSection("GlobalSettings"), GlobalSettings);
}
}
public class DatabaseContextFactory : IDesignTimeDbContextFactory<DatabaseContext>
{
public DatabaseContext CreateDbContext(string[] args)
{
var globalSettings = GlobalSettingsFactory.GlobalSettings;
var optionsBuilder = new DbContextOptionsBuilder<DatabaseContext>();
var connectionString = globalSettings.PostgreSql?.ConnectionString;
if (string.IsNullOrWhiteSpace(connectionString))
public static GlobalSettings GlobalSettings { get; } = new GlobalSettings();
static GlobalSettingsFactory()
{
throw new Exception("No Postgres connection string found.");
var configBuilder = new ConfigurationBuilder().AddUserSecrets<Bit.Api.Startup>();
var Configuration = configBuilder.Build();
ConfigurationBinder.Bind(Configuration.GetSection("GlobalSettings"), GlobalSettings);
}
}
public class DatabaseContextFactory : IDesignTimeDbContextFactory<DatabaseContext>
{
public DatabaseContext CreateDbContext(string[] args)
{
var globalSettings = GlobalSettingsFactory.GlobalSettings;
var optionsBuilder = new DbContextOptionsBuilder<DatabaseContext>();
var connectionString = globalSettings.PostgreSql?.ConnectionString;
if (string.IsNullOrWhiteSpace(connectionString))
{
throw new Exception("No Postgres connection string found.");
}
optionsBuilder.UseNpgsql(
connectionString,
b => b.MigrationsAssembly("PostgresMigrations"));
return new DatabaseContext(optionsBuilder.Options);
}
optionsBuilder.UseNpgsql(
connectionString,
b => b.MigrationsAssembly("PostgresMigrations"));
return new DatabaseContext(optionsBuilder.Options);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,74 +1,75 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class RemoveProviderOrganizationProviderUser : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class RemoveProviderOrganizationProviderUser : Migration
{
migrationBuilder.DropTable(
name: "ProviderOrganizationProviderUser");
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ProviderOrganizationProviderUser");
migrationBuilder.AddColumn<Guid>(
name: "ProviderId",
table: "Event",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "ProviderId",
table: "Event",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "ProviderUserId",
table: "Event",
type: "uuid",
nullable: true);
}
migrationBuilder.AddColumn<Guid>(
name: "ProviderUserId",
table: "Event",
type: "uuid",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ProviderId",
table: "Event");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ProviderId",
table: "Event");
migrationBuilder.DropColumn(
name: "ProviderUserId",
table: "Event");
migrationBuilder.DropColumn(
name: "ProviderUserId",
table: "Event");
migrationBuilder.CreateTable(
name: "ProviderOrganizationProviderUser",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CreationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Permissions = table.Column<string>(type: "text", nullable: true),
ProviderOrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
ProviderUserId = table.Column<Guid>(type: "uuid", nullable: false),
RevisionDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Type = table.Column<byte>(type: "smallint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProviderOrganizationProviderUser", x => x.Id);
table.ForeignKey(
name: "FK_ProviderOrganizationProviderUser_ProviderOrganization_Provi~",
column: x => x.ProviderOrganizationId,
principalTable: "ProviderOrganization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProviderOrganizationProviderUser_ProviderUser_ProviderUserId",
column: x => x.ProviderUserId,
principalTable: "ProviderUser",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ProviderOrganizationProviderUser",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CreationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Permissions = table.Column<string>(type: "text", nullable: true),
ProviderOrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
ProviderUserId = table.Column<Guid>(type: "uuid", nullable: false),
RevisionDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Type = table.Column<byte>(type: "smallint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProviderOrganizationProviderUser", x => x.Id);
table.ForeignKey(
name: "FK_ProviderOrganizationProviderUser_ProviderOrganization_Provi~",
column: x => x.ProviderOrganizationId,
principalTable: "ProviderOrganization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProviderOrganizationProviderUser_ProviderUser_ProviderUserId",
column: x => x.ProviderUserId,
principalTable: "ProviderUser",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ProviderOrganizationProviderUser_ProviderOrganizationId",
table: "ProviderOrganizationProviderUser",
column: "ProviderOrganizationId");
migrationBuilder.CreateIndex(
name: "IX_ProviderOrganizationProviderUser_ProviderOrganizationId",
table: "ProviderOrganizationProviderUser",
column: "ProviderOrganizationId");
migrationBuilder.CreateIndex(
name: "IX_ProviderOrganizationProviderUser_ProviderUserId",
table: "ProviderOrganizationProviderUser",
column: "ProviderUserId");
migrationBuilder.CreateIndex(
name: "IX_ProviderOrganizationProviderUser_ProviderUserId",
table: "ProviderOrganizationProviderUser",
column: "ProviderUserId");
}
}
}

View File

@ -1,23 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class UserForcePasswordReset : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class UserForcePasswordReset : Migration
{
migrationBuilder.AddColumn<bool>(
name: "ForcePasswordReset",
table: "User",
type: "boolean",
nullable: false,
defaultValue: false);
}
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "ForcePasswordReset",
table: "User",
type: "boolean",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ForcePasswordReset",
table: "User");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ForcePasswordReset",
table: "User");
}
}
}

View File

@ -1,42 +1,43 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class AddMaxAutoscaleSeatsToOrganization : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class AddMaxAutoscaleSeatsToOrganization : Migration
{
migrationBuilder.AddColumn<int>(
name: "MaxAutoscaleSeats",
table: "Organization",
type: "integer",
nullable: true);
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "MaxAutoscaleSeats",
table: "Organization",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "OwnersNotifiedOfAutoscaling",
table: "Organization",
type: "timestamp without time zone",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "OwnersNotifiedOfAutoscaling",
table: "Organization",
type: "timestamp without time zone",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "ProviderOrganizationId",
table: "Event",
type: "uuid",
nullable: true);
}
migrationBuilder.AddColumn<Guid>(
name: "ProviderOrganizationId",
table: "Event",
type: "uuid",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MaxAutoscaleSeats",
table: "Organization");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MaxAutoscaleSeats",
table: "Organization");
migrationBuilder.DropColumn(
name: "OwnersNotifiedOfAutoscaling",
table: "Organization");
migrationBuilder.DropColumn(
name: "OwnersNotifiedOfAutoscaling",
table: "Organization");
migrationBuilder.DropColumn(
name: "ProviderOrganizationId",
table: "Event");
migrationBuilder.DropColumn(
name: "ProviderOrganizationId",
table: "Event");
}
}
}

View File

@ -1,20 +1,21 @@
using Bit.Core.Utilities;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class SplitManageCollectionsPermissions2 : Migration
namespace Bit.PostgresMigrations.Migrations
{
private const string _scriptLocation =
"PostgresMigrations.Scripts.2021-09-21_01_SplitManageCollectionsPermission.psql";
protected override void Up(MigrationBuilder migrationBuilder)
public partial class SplitManageCollectionsPermissions2 : Migration
{
migrationBuilder.Sql(CoreHelpers.GetEmbeddedResourceContentsAsync(_scriptLocation));
}
private const string _scriptLocation =
"PostgresMigrations.Scripts.2021-09-21_01_SplitManageCollectionsPermission.psql";
protected override void Down(MigrationBuilder migrationBuilder)
{
throw new Exception("Irreversible migration");
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(CoreHelpers.GetEmbeddedResourceContentsAsync(_scriptLocation));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
throw new Exception("Irreversible migration");
}
}
}

View File

@ -1,20 +1,21 @@
using Bit.Core.Utilities;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class SetMaxAutoscaleSeatsToCurrentSeatCount : Migration
namespace Bit.PostgresMigrations.Migrations
{
private const string _scriptLocation =
"PostgresMigrations.Scripts.2021-10-21_00_SetMaxAutoscaleSeatCount.psql";
protected override void Up(MigrationBuilder migrationBuilder)
public partial class SetMaxAutoscaleSeatsToCurrentSeatCount : Migration
{
migrationBuilder.Sql(CoreHelpers.GetEmbeddedResourceContentsAsync(_scriptLocation));
}
private const string _scriptLocation =
"PostgresMigrations.Scripts.2021-10-21_00_SetMaxAutoscaleSeatCount.psql";
protected override void Down(MigrationBuilder migrationBuilder)
{
throw new Exception("Irreversible migration");
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(CoreHelpers.GetEmbeddedResourceContentsAsync(_scriptLocation));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
throw new Exception("Irreversible migration");
}
}
}

View File

@ -1,23 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class KeyConnector : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class KeyConnector : Migration
{
migrationBuilder.AddColumn<bool>(
name: "UsesKeyConnector",
table: "User",
type: "boolean",
nullable: false,
defaultValue: false);
}
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "UsesKeyConnector",
table: "User",
type: "boolean",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UsesKeyConnector",
table: "User");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UsesKeyConnector",
table: "User");
}
}
}

View File

@ -1,81 +1,82 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class OrganizationSponsorship : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class OrganizationSponsorship : Migration
{
migrationBuilder.AddColumn<bool>(
name: "UsesCryptoAgent",
table: "User",
type: "boolean",
nullable: false,
defaultValue: false);
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "UsesCryptoAgent",
table: "User",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "OrganizationSponsorship",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
InstallationId = table.Column<Guid>(type: "uuid", nullable: true),
SponsoringOrganizationId = table.Column<Guid>(type: "uuid", nullable: true),
SponsoringOrganizationUserId = table.Column<Guid>(type: "uuid", nullable: true),
SponsoredOrganizationId = table.Column<Guid>(type: "uuid", nullable: true),
FriendlyName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
OfferedToEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
PlanSponsorshipType = table.Column<byte>(type: "smallint", nullable: true),
CloudSponsor = table.Column<bool>(type: "boolean", nullable: false),
LastSyncDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
TimesRenewedWithoutValidation = table.Column<byte>(type: "smallint", nullable: false),
SponsorshipLapsedDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_OrganizationSponsorship", x => x.Id);
table.ForeignKey(
name: "FK_OrganizationSponsorship_Installation_InstallationId",
column: x => x.InstallationId,
principalTable: "Installation",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoredOrganizationId",
column: x => x.SponsoredOrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
column: x => x.SponsoringOrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "OrganizationSponsorship",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
InstallationId = table.Column<Guid>(type: "uuid", nullable: true),
SponsoringOrganizationId = table.Column<Guid>(type: "uuid", nullable: true),
SponsoringOrganizationUserId = table.Column<Guid>(type: "uuid", nullable: true),
SponsoredOrganizationId = table.Column<Guid>(type: "uuid", nullable: true),
FriendlyName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
OfferedToEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
PlanSponsorshipType = table.Column<byte>(type: "smallint", nullable: true),
CloudSponsor = table.Column<bool>(type: "boolean", nullable: false),
LastSyncDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
TimesRenewedWithoutValidation = table.Column<byte>(type: "smallint", nullable: false),
SponsorshipLapsedDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_OrganizationSponsorship", x => x.Id);
table.ForeignKey(
name: "FK_OrganizationSponsorship_Installation_InstallationId",
column: x => x.InstallationId,
principalTable: "Installation",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoredOrganizationId",
column: x => x.SponsoredOrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
column: x => x.SponsoringOrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_OrganizationSponsorship_InstallationId",
table: "OrganizationSponsorship",
column: "InstallationId");
migrationBuilder.CreateIndex(
name: "IX_OrganizationSponsorship_InstallationId",
table: "OrganizationSponsorship",
column: "InstallationId");
migrationBuilder.CreateIndex(
name: "IX_OrganizationSponsorship_SponsoredOrganizationId",
table: "OrganizationSponsorship",
column: "SponsoredOrganizationId");
migrationBuilder.CreateIndex(
name: "IX_OrganizationSponsorship_SponsoredOrganizationId",
table: "OrganizationSponsorship",
column: "SponsoredOrganizationId");
migrationBuilder.CreateIndex(
name: "IX_OrganizationSponsorship_SponsoringOrganizationId",
table: "OrganizationSponsorship",
column: "SponsoringOrganizationId");
}
migrationBuilder.CreateIndex(
name: "IX_OrganizationSponsorship_SponsoringOrganizationId",
table: "OrganizationSponsorship",
column: "SponsoringOrganizationId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "OrganizationSponsorship");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "OrganizationSponsorship");
migrationBuilder.DropColumn(
name: "UsesCryptoAgent",
table: "User");
migrationBuilder.DropColumn(
name: "UsesCryptoAgent",
table: "User");
}
}
}

View File

@ -1,23 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class KeyConnectorFlag : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class KeyConnectorFlag : Migration
{
migrationBuilder.AddColumn<bool>(
name: "UseKeyConnector",
table: "Organization",
type: "boolean",
nullable: false,
defaultValue: false);
}
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "UseKeyConnector",
table: "Organization",
type: "boolean",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UseKeyConnector",
table: "Organization");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UseKeyConnector",
table: "Organization");
}
}
}

View File

@ -1,45 +1,46 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Bit.PostgresMigrations.Migrations;
public partial class RemoveU2F : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class RemoveU2F : Migration
{
migrationBuilder.DropTable(
name: "U2f");
}
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "U2f");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "U2f",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
AppId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
Challenge = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
CreationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
KeyHandle = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
Version = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_U2f", x => x.Id);
table.ForeignKey(
name: "FK_U2f_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "U2f",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
AppId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
Challenge = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
CreationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
KeyHandle = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
Version = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_U2f", x => x.Id);
table.ForeignKey(
name: "FK_U2f_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_U2f_UserId",
table: "U2f",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_U2f_UserId",
table: "U2f",
column: "UserId");
}
}
}

View File

@ -1,33 +1,34 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class FailedLoginCaptcha : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class FailedLoginCaptcha : Migration
{
migrationBuilder.AddColumn<int>(
name: "FailedLoginCount",
table: "User",
type: "integer",
nullable: false,
defaultValue: 0);
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "FailedLoginCount",
table: "User",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<DateTime>(
name: "LastFailedLoginDate",
table: "User",
type: "timestamp without time zone",
nullable: true);
}
migrationBuilder.AddColumn<DateTime>(
name: "LastFailedLoginDate",
table: "User",
type: "timestamp without time zone",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "FailedLoginCount",
table: "User");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "FailedLoginCount",
table: "User");
migrationBuilder.DropColumn(
name: "LastFailedLoginDate",
table: "User");
migrationBuilder.DropColumn(
name: "LastFailedLoginDate",
table: "User");
}
}
}

View File

@ -1,153 +1,154 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class SelfHostF4E : Migration
namespace Bit.PostgresMigrations.Migrations
{
private const string _scriptLocationTemplate = "2022-03-01_00_{0}_MigrateOrganizationApiKeys.psql";
protected override void Up(MigrationBuilder migrationBuilder)
public partial class SelfHostF4E : Migration
{
migrationBuilder.DropForeignKey(
name: "FK_OrganizationSponsorship_Installation_InstallationId",
table: "OrganizationSponsorship");
private const string _scriptLocationTemplate = "2022-03-01_00_{0}_MigrateOrganizationApiKeys.psql";
migrationBuilder.DropIndex(
name: "IX_OrganizationSponsorship_InstallationId",
table: "OrganizationSponsorship");
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_OrganizationSponsorship_Installation_InstallationId",
table: "OrganizationSponsorship");
migrationBuilder.DropColumn(
name: "InstallationId",
table: "OrganizationSponsorship");
migrationBuilder.DropIndex(
name: "IX_OrganizationSponsorship_InstallationId",
table: "OrganizationSponsorship");
migrationBuilder.DropColumn(
name: "TimesRenewedWithoutValidation",
table: "OrganizationSponsorship");
migrationBuilder.DropColumn(
name: "InstallationId",
table: "OrganizationSponsorship");
migrationBuilder.CreateTable(
name: "OrganizationApiKey",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
Type = table.Column<byte>(type: "smallint", nullable: false),
ApiKey = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: true),
RevisionDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrganizationApiKey", x => x.Id);
table.ForeignKey(
name: "FK_OrganizationApiKey_Organization_OrganizationId",
column: x => x.OrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.DropColumn(
name: "TimesRenewedWithoutValidation",
table: "OrganizationSponsorship");
migrationBuilder.SqlResource(_scriptLocationTemplate);
migrationBuilder.CreateTable(
name: "OrganizationApiKey",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
Type = table.Column<byte>(type: "smallint", nullable: false),
ApiKey = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: true),
RevisionDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrganizationApiKey", x => x.Id);
table.ForeignKey(
name: "FK_OrganizationApiKey_Organization_OrganizationId",
column: x => x.OrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.DropColumn(
name: "ApiKey",
table: "Organization");
migrationBuilder.SqlResource(_scriptLocationTemplate);
migrationBuilder.RenameColumn(
name: "SponsorshipLapsedDate",
table: "OrganizationSponsorship",
newName: "ValidUntil");
migrationBuilder.DropColumn(
name: "ApiKey",
table: "Organization");
migrationBuilder.RenameColumn(
name: "CloudSponsor",
table: "OrganizationSponsorship",
newName: "ToDelete");
migrationBuilder.RenameColumn(
name: "SponsorshipLapsedDate",
table: "OrganizationSponsorship",
newName: "ValidUntil");
migrationBuilder.RenameColumn(
name: "CloudSponsor",
table: "OrganizationSponsorship",
newName: "ToDelete");
migrationBuilder.CreateTable(
name: "OrganizationConnection",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Type = table.Column<byte>(type: "smallint", nullable: false),
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
Config = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_OrganizationConnection", x => x.Id);
table.ForeignKey(
name: "FK_OrganizationConnection_Organization_OrganizationId",
column: x => x.OrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "OrganizationConnection",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Type = table.Column<byte>(type: "smallint", nullable: false),
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
Config = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_OrganizationConnection", x => x.Id);
table.ForeignKey(
name: "FK_OrganizationConnection_Organization_OrganizationId",
column: x => x.OrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_OrganizationApiKey_OrganizationId",
table: "OrganizationApiKey",
column: "OrganizationId");
migrationBuilder.CreateIndex(
name: "IX_OrganizationApiKey_OrganizationId",
table: "OrganizationApiKey",
column: "OrganizationId");
migrationBuilder.CreateIndex(
name: "IX_OrganizationConnection_OrganizationId",
table: "OrganizationConnection",
column: "OrganizationId");
}
migrationBuilder.CreateIndex(
name: "IX_OrganizationConnection_OrganizationId",
table: "OrganizationConnection",
column: "OrganizationId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ApiKey",
table: "Organization",
type: "character varying(30)",
maxLength: 30,
nullable: true);
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ApiKey",
table: "Organization",
type: "character varying(30)",
maxLength: 30,
nullable: true);
migrationBuilder.SqlResource(_scriptLocationTemplate);
migrationBuilder.SqlResource(_scriptLocationTemplate);
migrationBuilder.DropTable(
name: "OrganizationApiKey");
migrationBuilder.DropTable(
name: "OrganizationApiKey");
migrationBuilder.DropTable(
name: "OrganizationConnection");
migrationBuilder.DropTable(
name: "OrganizationConnection");
migrationBuilder.RenameColumn(
name: "ValidUntil",
table: "OrganizationSponsorship",
newName: "SponsorshipLapsedDate");
migrationBuilder.RenameColumn(
name: "ValidUntil",
table: "OrganizationSponsorship",
newName: "SponsorshipLapsedDate");
migrationBuilder.RenameColumn(
name: "ToDelete",
table: "OrganizationSponsorship",
newName: "CloudSponsor");
migrationBuilder.RenameColumn(
name: "ToDelete",
table: "OrganizationSponsorship",
newName: "CloudSponsor");
migrationBuilder.AddColumn<Guid>(
name: "InstallationId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "InstallationId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<byte>(
name: "TimesRenewedWithoutValidation",
table: "OrganizationSponsorship",
type: "smallint",
nullable: false,
defaultValue: (byte)0);
migrationBuilder.AddColumn<byte>(
name: "TimesRenewedWithoutValidation",
table: "OrganizationSponsorship",
type: "smallint",
nullable: false,
defaultValue: (byte)0);
migrationBuilder.CreateIndex(
name: "IX_OrganizationSponsorship_InstallationId",
table: "OrganizationSponsorship",
column: "InstallationId");
migrationBuilder.CreateIndex(
name: "IX_OrganizationSponsorship_InstallationId",
table: "OrganizationSponsorship",
column: "InstallationId");
migrationBuilder.AddForeignKey(
name: "FK_OrganizationSponsorship_Installation_InstallationId",
table: "OrganizationSponsorship",
column: "InstallationId",
principalTable: "Installation",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_OrganizationSponsorship_Installation_InstallationId",
table: "OrganizationSponsorship",
column: "InstallationId",
principalTable: "Installation",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

View File

@ -1,72 +1,73 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class SponsorshipBulkActions : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class SponsorshipBulkActions : Migration
{
migrationBuilder.DropForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship");
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship");
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationUserId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationUserId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship",
column: "SponsoringOrganizationId",
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
migrationBuilder.AddForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship",
column: "SponsoringOrganizationId",
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship");
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationUserId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationUserId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship",
column: "SponsoringOrganizationId",
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship",
column: "SponsoringOrganizationId",
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

View File

@ -1,64 +1,65 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class AddInstallationIdToEvents : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class AddInstallationIdToEvents : Migration
{
migrationBuilder.DropForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship");
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship");
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddColumn<Guid>(
name: "InstallationId",
table: "Event",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "InstallationId",
table: "Event",
type: "uuid",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship",
column: "SponsoringOrganizationId",
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
migrationBuilder.AddForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship",
column: "SponsoringOrganizationId",
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship");
migrationBuilder.DropColumn(
name: "InstallationId",
table: "Event");
migrationBuilder.DropColumn(
name: "InstallationId",
table: "Event");
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "SponsoringOrganizationId",
table: "OrganizationSponsorship",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship",
column: "SponsoringOrganizationId",
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_OrganizationSponsorship_Organization_SponsoringOrganization~",
table: "OrganizationSponsorship",
column: "SponsoringOrganizationId",
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -1,23 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations;
public partial class DeviceUnknownVerification : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class DeviceUnknownVerification : Migration
{
migrationBuilder.AddColumn<bool>(
name: "UnknownDeviceVerificationEnabled",
table: "User",
type: "boolean",
nullable: false,
defaultValue: true);
}
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "UnknownDeviceVerificationEnabled",
table: "User",
type: "boolean",
nullable: false,
defaultValue: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UnknownDeviceVerificationEnabled",
table: "User");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UnknownDeviceVerificationEnabled",
table: "User");
}
}
}

View File

@ -2,24 +2,25 @@
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
public partial class UseScimFlag : Migration
namespace Bit.PostgresMigrations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
public partial class UseScimFlag : Migration
{
migrationBuilder.AddColumn<bool>(
name: "UseScim",
table: "Organization",
type: "boolean",
nullable: false,
defaultValue: false);
}
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "UseScim",
table: "Organization",
type: "boolean",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UseScim",
table: "Organization");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UseScim",
table: "Organization");
}
}
}