Exemple #1
0
        public void ShouldScriptAllTables()
        {
            IList <DbObjectName> tables = engine.GetAllTables(connectionSettings);

            scriptingOptions.AddTablesToScript(tables);
            engine.Script(connectionSettings, scriptingOptions);
        }
        //[Test]
        public void ScriptData()
        {
            IList <DbObjectName> tables = engine.GetAllTables(connSettings1);

            ScriptingOptions options = new ScriptingOptions();

            options.ExportDirectory = exportDir;
            options.ScriptData      = true;
            options.AddTablesToScript(tables);

            engine.Script(connSettings1, options);
        }
Exemple #3
0
        public void ShouldScriptAllTableFKs()
        {
            IList <DbObjectName> tables = engine.GetAllTables(connSettings);

            ScriptingOptions options = new ScriptingOptions();

            options.ExportDirectory   = exportDir;
            options.ScriptForeignKeys = true;
            options.AddTablesToScript(tables);

            engine.Script(connSettings, options);

            string dataPath = Path.Combine(exportDir, "Schema\\ForeignKeys");

            Assert.IsTrue(File.Exists(Path.Combine(dataPath, "dbo.Address.sql")), "address script missing");
        }
        public void ShouldScriptCustomerDataDifferences()
        {
            IList <DbObjectName> tables = engine.GetAllTables(connSettings1);

            ScriptingOptions options = new ScriptingOptions();

            options.ExportDirectory = exportDir;
            options.ScriptData      = true;
            options.AddTablesToScript(tables);

            engine.ScriptDifferences(connSettings1, connSettings2, options);

            string dataPath = Path.Combine(exportDir, "\\Data");

            Assert.IsTrue(File.Exists(Path.Combine(dataPath, "dbo.Customer.sql")));
            Assert.IsTrue(File.Exists(Path.Combine(dataPath, "dbo.Address.sql")));
            Assert.IsTrue(File.Exists(Path.Combine(dataPath, "dbo.SoftwareVersion.sql")));
        }
Exemple #5
0
        public void ShouldScriptAllTableIndexes()
        {
            IList <DbObjectName> tables = engine.GetAllTables(connSettings);

            ScriptingOptions options = new ScriptingOptions();

            options.ExportDirectory = exportDir;
            options.ScriptIndexes   = true;
            options.AddTablesToScript(tables);

            engine.Script(connSettings, options);

            string dataPath = Path.Combine(exportDir, "Schema\\Indexes");

            Assert.IsTrue(File.Exists(Path.Combine(dataPath, "dbo.Customer.sql")), "customer script missing");
            Assert.IsTrue(File.Exists(Path.Combine(dataPath, "dbo.Country.sql")), "country script missing");
            Assert.IsTrue(File.Exists(Path.Combine(dataPath, "dbo.Address.sql")), "address script missing");
            Assert.IsTrue(File.Exists(Path.Combine(dataPath, "dbo.SoftwareVersion.sql")), "software script missing");
        }
Exemple #6
0
        public void ShouldScriptEverythingToSingleScript()
        {
            IList <DbObjectName> views  = engine.GetAllViews(connSettings);
            IList <DbObjectName> sprocs = engine.GetAllSprocs(connSettings);
            IList <DbObjectName> tables = engine.GetAllTables(connSettings);

            ScriptingOptions options = new ScriptingOptions();

            options.ExportDirectory = exportDir;
            options.AddTablesToScript(tables);
            options.AddSprocsToScript(sprocs);
            options.AddViewsToScript(views);
            options.ScriptData        = true;
            options.ScriptForeignKeys = true;
            options.ScriptIndexes     = true;
            options.ScriptSchema      = true;
            options.UseMultipleFiles  = false;

            engine.Script(connSettings, options);

            Assert.IsTrue(File.Exists(Path.Combine(exportDir, "SqlMigration1.sql")));
        }