コード例 #1
0
        public RunGroupOrderScenarios()
        {
            upgradeResult = null;
            scripts       = new List <SqlScript>
            {
                new SqlScript("ZZZScript1.sql", "create table Foo (Id int identity)", new SqlScriptOptions {
                    ScriptType = ScriptType.RunOnce, RunGroupOrder = DbUpDefaults.DefaultRunGroupOrder
                }),
                new SqlScript("ZZZScript2.sql", "alter table Foo add column Name varchar(255)", new SqlScriptOptions {
                    ScriptType = ScriptType.RunOnce, RunGroupOrder = DbUpDefaults.DefaultRunGroupOrder
                }),
                new SqlScript("AAAScript3.sql", "insert into Foo (Name) values ('test')", new SqlScriptOptions {
                    ScriptType = ScriptType.RunOnce, RunGroupOrder = DbUpDefaults.DefaultRunGroupOrder + 1
                })
            };

            logger = new CaptureLogsLogger();
            recordingConnection   = new RecordingDbConnection(logger, "SchemaVersions");
            testConnectionFactory = new DelegateConnectionFactory(_ => recordingConnection);

            upgradeEngineBuilder = DeployChanges.To
                                   .SqlDatabase("testconn")
                                   .WithScripts(new TestScriptProvider(scripts))
                                   .OverrideConnectionFactory(testConnectionFactory)
                                   .LogTo(logger);
        }
コード例 #2
0
        public UpgradeDatabaseScenarios()
        {
            upgradeResult = null;
            scripts       = new List <SqlScript>
            {
                new SqlScript("Script1.sql", "create table Foo (Id int identity)"),
                new SqlScript("Script2.sql", "alter table Foo add column Name varchar(255)"),
                new SqlScript("Script3.sql", "insert into Foo (Name) values ('test')")
            };

            executedScripts = new List <ExecutedSqlScript>
            {
                new ExecutedSqlScript {
                    Name = "Script1.sql", Hash = "a"
                },
                new ExecutedSqlScript {
                    Name = "Script2.sql", Hash = "b"
                },
                new ExecutedSqlScript {
                    Name = "Script3.sql", Hash = "c"
                }
            };

            logger = new CaptureLogsLogger();
            recordingConnection   = new RecordingDbConnection(logger, "SchemaVersions");
            testConnectionFactory = new DelegateConnectionFactory(_ => recordingConnection);

            upgradeEngineBuilder = DeployChanges.To
                                   .SqlDatabase("testconn")
                                   .WithScripts(new TestScriptProvider(scripts))
                                   .OverrideConnectionFactory(testConnectionFactory)
                                   .LogTo(logger);
        }
コード例 #3
0
        public TransactionScenarios()
        {
            logger = new CaptureLogsLogger();

            // Automatically approve the change, make sure to check the result before committing
            // assentConfig = assentConfig.UsingReporter((received, approved) => File.Copy(received, approved, true));
        }
コード例 #4
0
ファイル: DatabaseSupportTests.cs プロジェクト: suprcodr/DbUp
        Action Deploy(Func <SupportedDatabases, UpgradeEngineBuilder> deployTo, Func <UpgradeEngineBuilder, string, string, UpgradeEngineBuilder> addCustomNamedJournal)
        {
            return(() =>
            {
                scripts = new List <SqlScript>();
                logger = new CaptureLogsLogger();
                recordingConnection = new RecordingDbConnection(logger, "SchemaVersions");
                testConnectionFactory = new DelegateConnectionFactory(_ => recordingConnection);
                upgradeEngineBuilder = deployTo(DeployChanges.To)
                                       .WithScripts(scripts)
                                       .OverrideConnectionFactory(testConnectionFactory)
                                       .LogTo(logger);

                addCustomNamedJournalToBuilder = addCustomNamedJournal;
            });
        }
コード例 #5
0
 public TransactionScenarios()
 {
     logger = new CaptureLogsLogger();
 }