Browse Source
* Default autoscaling to off * Update util/Migrator/DbScripts/2021-10-21_00_DefaultAutoscaleLimitToCurrentSeats.sql Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * Update util/Migrator/DbScripts/2021-10-21_00_DefaultAutoscaleLimitToCurrentSeats.sql Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * Update util/MySqlMigrations/Scripts/2021-10-21_00_SetMaxAutoscaleSeatCount.sql Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com>pull/1661/head
9 changed files with 3071 additions and 0 deletions
@ -0,0 +1,6 @@ |
|||||||
|
IF NOT EXISTS (SELECT TOP(1) 1 FROM [dbo].[Organization] WHERE [MaxAutoscaleSeats] IS NOT NULL) |
||||||
|
AND NOT EXISTS ( SELECT TOP(1) 1 FROM [dbo].[Organization] WHERE [OwnersNotifiedOfAutoscaling] IS NOT NULL) |
||||||
|
BEGIN |
||||||
|
UPDATE [dbo].[Organization] |
||||||
|
SET MaxAutoscaleSeats = Seats |
||||||
|
END |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@ |
|||||||
|
using System; |
||||||
|
using Bit.Core.Utilities; |
||||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||||
|
|
||||||
|
namespace Bit.MySqlMigrations.Migrations |
||||||
|
{ |
||||||
|
public partial class SetMaxAutoscaleSeatsToCurrentSeatCount : Migration |
||||||
|
{ |
||||||
|
private const string _scriptLocation = |
||||||
|
"MySqlMigrations.Scripts.2021-10-21_00_SetMaxAutoscaleSeatCount.sql"; |
||||||
|
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
migrationBuilder.Sql(CoreHelpers.GetEmbeddedResourceContentsAsync(_scriptLocation)); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
throw new Exception("Irreversible migration"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
SET @run_migration_seats = 0; |
||||||
|
SELECT 1 FROM `Organization` |
||||||
|
WHERE `MaxAutoscaleSeats` IS NOT NULL |
||||||
|
LIMIT 1 |
||||||
|
INTO @run_migration_seats; |
||||||
|
|
||||||
|
SET @run_migration_email = 0; |
||||||
|
SELECT 1 FROM `Organization` |
||||||
|
WHERE `OwnersNotifiedOfAutoscaling` IS NOT NULL |
||||||
|
LIMIT 1 |
||||||
|
INTO @run_migration_email; |
||||||
|
|
||||||
|
SET @stmt = case @run_migration_seats + @run_migration_email |
||||||
|
WHEN 0 THEN 'UPDATE `Organization` SET `MaxAutoscaleSeats` = `Seats`' |
||||||
|
ELSE 'SELECT ''No migration necessary''' |
||||||
|
END; |
||||||
|
|
||||||
|
PREPARE stmt FROM @stmt; |
||||||
|
EXECUTE stmt; |
||||||
|
DEALLOCATE PREPARE stmt; |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@ |
|||||||
|
using System; |
||||||
|
using Bit.Core.Utilities; |
||||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||||
|
|
||||||
|
namespace Bit.PostgresMigrations.Migrations |
||||||
|
{ |
||||||
|
public partial class SetMaxAutoscaleSeatsToCurrentSeatCount : Migration |
||||||
|
{ |
||||||
|
private const string _scriptLocation = |
||||||
|
"PostgresMigration.Scripts.2021-10-21_00_SetMaxAutoscaleSeatCount.sql"; |
||||||
|
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
migrationBuilder.Sql(CoreHelpers.GetEmbeddedResourceContentsAsync(_scriptLocation)); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
throw new Exception("Irreversible migration"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,4 @@ |
|||||||
|
UPDATE "Organization" |
||||||
|
SET "MaxAutoscaleSeats" = "Seats" |
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM "Organization" WHERE "MaxAutoscaleSeats" IS NOT NULL LIMIT 1) |
||||||
|
AND NOT EXISTS (SELECT 1 FROM "Organization" WHERE "OwnersNotifiedOfAutoscaling" IS NOT NULL LIMIT 1) |
||||||
Loading…
Reference in new issue