1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-22 21:51:22 +01:00

cleanup installer. break apart update script

This commit is contained in:
Kyle Spearrin 2018-07-19 16:01:54 -04:00
parent 0e7ceed68f
commit 266fc579f2
5 changed files with 13 additions and 41 deletions

View File

@ -1,23 +0,0 @@
using System;
using System.IO;
namespace Bit.Setup
{
public class AppSettingsBuilder
{
public void Build()
{
Console.WriteLine("Building app settings.");
Directory.CreateDirectory("/bitwarden/web/");
using(var sw = File.CreateText("/bitwarden/web/settings.js"))
{
sw.Write($@"var bitwardenAppSettings = {{
iconsUri: ""/icons"",
stripeKey: null,
braintreeKey: null,
selfHosted: true
}};");
}
}
}
}

View File

@ -7,16 +7,6 @@ BEGIN
END
GO
IF NOT EXISTS (
SELECT * FROM sys.indexes WHERE [Name]='IX_User_Premium_PremiumExpirationDate_RenewalReminderDate'
AND object_id = OBJECT_ID('[dbo].[User]')
)
BEGIN
CREATE NONCLUSTERED INDEX [IX_User_Premium_PremiumExpirationDate_RenewalReminderDate]
ON [dbo].[User]([Premium] ASC, [PremiumExpirationDate] ASC, [RenewalReminderDate] ASC)
END
GO
IF OBJECT_ID('[dbo].[User_Create]') IS NOT NULL
BEGIN
DROP PROCEDURE [dbo].[User_Create]

View File

@ -0,0 +1,9 @@
IF NOT EXISTS (
SELECT * FROM sys.indexes WHERE [Name]='IX_User_Premium_PremiumExpirationDate_RenewalReminderDate'
AND object_id = OBJECT_ID('[dbo].[User]')
)
BEGIN
CREATE NONCLUSTERED INDEX [IX_User_Premium_PremiumExpirationDate_RenewalReminderDate]
ON [dbo].[User]([Premium] ASC, [PremiumExpirationDate] ASC, [RenewalReminderDate] ASC)
END
GO

View File

@ -189,9 +189,6 @@ namespace Bit.Setup
};
environmentFileBuilder.BuildForInstaller();
var appSettingsBuilder = new AppSettingsBuilder();
appSettingsBuilder.Build();
var appIdBuilder = new AppIdBuilder(url);
appIdBuilder.Build();
@ -255,7 +252,7 @@ namespace Bit.Setup
.JournalToSqlTable("dbo", "Migration")
.WithScriptsAndCodeEmbeddedInAssembly(Assembly.GetExecutingAssembly(),
s => s.Contains($".DbScripts.") && !s.Contains(".Archive."))
.WithTransaction()
.WithTransactionPerScript()
.WithExecutionTimeout(new TimeSpan(0, 5, 0))
.LogToConsole()
.Build();
@ -272,7 +269,7 @@ namespace Bit.Setup
}
catch(SqlException e)
{
if(e.Message.Contains("Server is in script upgrade mode") && attempt < 3)
if(e.Message.Contains("Server is in script upgrade mode") && attempt < 10)
{
var nextAttempt = attempt + 1;
Console.WriteLine("Database is in script upgrade mode. " +
@ -351,9 +348,6 @@ namespace Bit.Setup
var nginxBuilder = new NginxConfigBuilder(domain, url);
nginxBuilder.BuildForUpdater();
var appSettingsBuilder = new AppSettingsBuilder();
appSettingsBuilder.Build();
var appIdBuilder = new AppIdBuilder(url);
appIdBuilder.Build();

View File

@ -11,9 +11,11 @@
<None Remove="DbScripts\2018-04-02_00_Org2fa.sql" />
<None Remove="DbScripts\2018-04-24_00_CipherQueryTuning.sql" />
<None Remove="DbScripts\2018-06-11_00_WebVaultUpdates.sql" />
<None Remove="DbScripts\2018-07-19_00_UserPremiumIndex.sql" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="DbScripts\2018-07-19_00_UserPremiumIndex.sql" />
<EmbeddedResource Include="DbScripts\2018-06-11_00_WebVaultUpdates.sql" />
<EmbeddedResource Include="DbScripts\2018-04-24_00_CipherQueryTuning.sql" />
<EmbeddedResource Include="DbScripts\2018-04-02_00_Org2fa.sql" />