-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathPostgresqlScriptExecutor.cs
More file actions
45 lines (43 loc) · 1.87 KB
/
Copy pathPostgresqlScriptExecutor.cs
File metadata and controls
45 lines (43 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using DbUp.Engine.Output;
using DbUp.Engine.Transactions;
namespace DBOps.Postgresql
{
public class PostgresqlScriptExecutor: DbUp.Postgresql.PostgresqlScriptExecutor
{
/// <summary>
/// Initializes an instance of the <see cref="PostgresqlScriptExecutor"/> class.
/// </summary>
/// <param name="connectionManagerFactory"></param>
/// <param name="log">The logging mechanism.</param>
/// <param name="schema">The schema that contains the table.</param>
/// <param name="variablesEnabled">Function that returns <c>true</c> if variables should be replaced, <c>false</c> otherwise.</param>
/// <param name="scriptPreprocessors">Script Preprocessors in addition to variable substitution</param>
/// <param name="journalFactory">Database journal</param>
public PostgresqlScriptExecutor(Func<IConnectionManager> connectionManagerFactory, Func<IUpgradeLog> log, string schema, Func<bool> variablesEnabled,
IEnumerable<DbUp.Engine.IScriptPreprocessor> scriptPreprocessors, Func<DbUp.Engine.IJournal> journalFactory)
: base(connectionManagerFactory, log, schema, variablesEnabled, scriptPreprocessors, journalFactory)
{
}
protected override void ExecuteCommandsWithinExceptionHandler(int index, DbUp.Engine.SqlScript script, Action executeCommand)
{
SqlScript s = (SqlScript)script;
var stopWatch = System.Diagnostics.Stopwatch.StartNew();
try
{
base.ExecuteCommandsWithinExceptionHandler(index, s, executeCommand);
}
catch
{
throw;
}
finally
{
stopWatch.Stop();
s.SetExecutionTime(stopWatch.ElapsedMilliseconds);
}
}
}
}