mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 09:02:48 -05:00
Add update from rerunable to not rerunable script
This commit is contained in:
@ -45,15 +45,21 @@ public class RerunableSqlTableJournal : SqlTableJournal
|
|||||||
rerunableParam.Value = Rerunable;
|
rerunableParam.Value = Rerunable;
|
||||||
command.Parameters.Add(rerunableParam);
|
command.Parameters.Add(rerunableParam);
|
||||||
|
|
||||||
// command.CommandText = GetInsertJournalEntrySql("@scriptName", "@applied");
|
command.CommandText = GetInsertJournalEntrySql("@scriptName", "@applied", "@rerunable");
|
||||||
command.CommandText = GetInsertJournalEntrySql("@scriptName", "@applied", "@rerrunable");
|
|
||||||
command.CommandType = CommandType.Text;
|
command.CommandType = CommandType.Text;
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string GetInsertJournalEntrySql(string @scriptName, string @applied, string @rerrunable)
|
protected string GetInsertJournalEntrySql(string @scriptName, string @applied, string @rerunable)
|
||||||
{
|
{
|
||||||
return $"insert into {FqSchemaTableName} (ScriptName, Applied, Rerunable) values ({@scriptName}, {@applied}, {@rerrunable})";
|
return $"IF EXISTS (SELECT * FROM {FqSchemaTableName} WHERE Rerunable = 1 AND ScriptName ='{@scriptName}')" +
|
||||||
|
"BEGIN" +
|
||||||
|
$"UPDATE {FqSchemaTableName} SET Applied = {@applied}, Rerunable = {@rerunable} WHERE ScriptName = '{@scriptName}'" +
|
||||||
|
"END" +
|
||||||
|
"ELSE" +
|
||||||
|
"BEGIN" +
|
||||||
|
$"insert into {FqSchemaTableName} (ScriptName, Applied, Rerunable) values ({@scriptName}, {@applied}, {@rerunable})" +
|
||||||
|
"END";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetJournalEntriesSql()
|
protected override string GetJournalEntriesSql()
|
||||||
|
Reference in New Issue
Block a user