1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

if check on db migration of scriptnames

This commit is contained in:
Kyle Spearrin 2017-09-18 11:21:32 -04:00
parent f4353b598e
commit 934b2c535b

View File

@ -136,9 +136,11 @@ namespace Bit.Setup
using(var connection = new SqlConnection(vaultConnectionString))
{
var command = new SqlCommand(
"IF ((SELECT COUNT(1) FROM INFORMATION_SCHEMA.TABLES " +
"WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'Migration') > 0) " +
"UPDATE [dbo].[Migration] " +
"SET [ScriptName] = REPLACE([ScriptName], 'Setup.DbScripts.', 'Bit.Setup.DbScripts.') " +
"WHERE [ScriptName] LIKE 'Setup.DbScripts.%'",
"WHERE [ScriptName] LIKE 'Setup.DbScripts.%';",
connection);
command.Connection.Open();
command.ExecuteNonQuery();