예제 #1
0
        public DeployExecutor(ScriptStore scriptStore, SchemaHistory schemaHistory, Database database, Clock clock, Feedback feedback)
        {
            if (scriptStore == null)
            {
                throw new ArgumentNullException("scriptStore");
            }
            if (schemaHistory == null)
            {
                throw new ArgumentNullException("schemaHistory");
            }
            if (database == null)
            {
                throw new ArgumentNullException("database");
            }
            if (clock == null)
            {
                throw new ArgumentNullException("clock");
            }
            if (feedback == null)
            {
                throw new ArgumentNullException("feedback");
            }

            this.scriptStore   = scriptStore;
            this.schemaHistory = schemaHistory;
            this.database      = database;
            this.clock         = clock;
            this.feedback      = feedback;
        }
예제 #2
0
        public Factory(CmdLineArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            feedback    = new ConsoleFeedback();
            clock       = new SystemClock();
            scriptStore = new DiskScriptStore(args.ScriptLocation);

            if (!string.Equals(args.DbType, "SqlServer", StringComparison.InvariantCultureIgnoreCase))
            {
                throw new Exception("Don't recognise DB type: " + args.DbType);
            }
            SqlServerDatabase sqlDatabase = new SqlServerDatabase(args.DbConnectionString);

            database      = sqlDatabase;
            schemaHistory = sqlDatabase;

            if (string.Equals("deploy", args.Mode, StringComparison.InvariantCultureIgnoreCase))
            {
                planner  = new DeployPlanner(scriptStore, schemaHistory);
                executor = new DeployExecutor(scriptStore, schemaHistory, database, clock, feedback);
            }
            else if (string.Equals("rollback", args.Mode, StringComparison.InvariantCultureIgnoreCase))
            {
                planner  = new RollbackPlanner(scriptStore, schemaHistory);
                executor = new RollbackExecutor(scriptStore, schemaHistory, database, clock, feedback);
            }
            else
            {
                throw new Exception("Don't recognise mode: " + args.Mode);
            }
        }
예제 #3
0
        public RollbackPlanner(ScriptStore scriptStore, SchemaHistory schemaHistory)
        {
            if (scriptStore == null)
            {
                throw new ArgumentNullException("scriptStore");
            }
            if (schemaHistory == null)
            {
                throw new ArgumentNullException("schemaHistory");
            }

            this.scriptStore   = scriptStore;
            this.schemaHistory = schemaHistory;
        }