예제 #1
0
        public bool Execute()
        {
            try
            {
                var deployer = new DbDeployer();
                deployer.Execute(this.config, Console.Out);

                return(true);
            }
            catch (UsageException ex)
            {
                Console.Error.WriteLine(ex.Message);

                this.PrintUsage();
            }
            catch (DbDeployException ex)
            {
                Console.Error.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Failed to apply changes: " + ex.Message);
                Console.Error.WriteLine("Stack Trace:");
                Console.Error.Write(ex.StackTrace);
            }

            return(false);
        }
예제 #2
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var config = new DbDeployConfig
            {
                Dbms               = DatabaseType,
                ConnectionString   = ConnectionString,
                ChangeLogTableName = TableName,
                ScriptDirectory    = Parser.ParseDirectory(deltasDirectory),
            };

            var deployer = new DbDeployer();

            deployer.Execute(config, new LambdaTextWriter(WriteVerbose));
        }
예제 #3
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            if (string.IsNullOrEmpty(this.OutputFile))
            {
                this.WriteError(new ErrorRecord(new PSInvalidOperationException(
                                                    "Missing a file for output"),
                                                "NoOutputFile",
                                                ErrorCategory.MetadataError,
                                                null));

                return;
            }

            var config = new DbDeployConfig
            {
                Dbms                     = this.DatabaseType,
                ConnectionString         = this.ConnectionString,
                ChangeLogTableName       = this.TableName,
                ScriptDirectory          = new DirectoryInfo(this.deltasDirectory),
                AutoCreateChangeLogTable = this.AutoCreateChangeLogTable,
                ForceUpdate              = this.ForceUpdate,
                UseSqlCmd                = this.UseSqlCmd,
                OutputFile               = new FileInfo(this.ToAbsolutePath(this.OutputFile))
            };

            if (!string.IsNullOrEmpty(this.UndoOutputFile))
            {
                config.OutputFile = new FileInfo(this.ToAbsolutePath(UndoOutputFile));
            }

            var deployer = new DbDeployer();

            deployer.Execute(config, new LambdaTextWriter(WriteVerbose));
        }