-
Notifications
You must be signed in to change notification settings - Fork 4
/
SnowflakeScriptExecutor.cs
37 lines (34 loc) · 1.27 KB
/
SnowflakeScriptExecutor.cs
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
using System;
using System.Collections.Generic;
using System.Data.Odbc;
using DbUp.Engine;
using DbUp.Engine.Output;
using DbUp.Engine.Transactions;
using DbUp.Support;
namespace DbUp.Snowflake
{
public class SnowflakeScriptExecutor : ScriptExecutor
{
public SnowflakeScriptExecutor(Func<IConnectionManager> connectionManagerFactory, Func<IUpgradeLog> log, string schema, Func<bool> variablesEnabled, List<IScriptPreprocessor> scriptPreprocessors,
Func<IJournal> journal)
: base(connectionManagerFactory, new SnowflakeObjectParser(), log, schema, variablesEnabled, scriptPreprocessors, journal)
{ }
protected override string GetVerifySchemaSql(string schema)
{
return $@"CREATE SCHEMA IF NOT EXISTS {schema}";
}
protected override void ExecuteCommandsWithinExceptionHandler(int index, SqlScript script, Action executeCallback)
{
try
{
executeCallback();
}
catch (OdbcException ex)
{
Log().WriteInformation("Snowflake exception has occured in script: '{0}'", script.Name);
Log().WriteError(ex.ToString());
throw;
}
}
}
}