/// <summary>
        /// Visits the given <paramref name="migrationNode"/>.
        /// </summary>
        /// <param name="migrationNode"></param>
        public override void Visit(IMigrationNode migrationNode)
        {
            textWriter.Write("migration \"{0}\"", GetIdentifier(migrationNode.Name));

            WriteProperties(migrationNode);
            VisitBlock(migrationNode);
        }
        public override void Visit(IMigrationNode migrationNode)
        {
            var revision = migrationNode.Properties["revision"] == null ?
                null :
                (int?)AstNodePropertyUtil.AsInteger(migrationNode.Properties["revision"].Value);

            migrationNode.Revision = revision ?? 1;
        }
        public override void Visit(IMigrationNode migrationNode)
        {
            //
            // Collect all IVersionNode objects
            List<IVersionNode> versionNodes = new List<IVersionNode>(Filter<IVersionNode>(migrationNode.ChildNodes));
            versionNodes.Sort(delegate(IVersionNode left, IVersionNode right) { return left.Number.CompareTo(right.Number); });

            for(int i = 0; i < migrationNode.ChildNodes.Count; ++i)
            {
                if(migrationNode.ChildNodes[i] is IVersionNode)
                    migrationNode.ChildNodes.RemoveAt(i--);
            } // for

            foreach(IVersionNode versionNode in versionNodes)
                migrationNode.ChildNodes.Add(versionNode);
        }
        public override void Visit(IMigrationNode migrationNode)
        {
            foreach(IVersionNode versionNode in Filter<IVersionNode>(migrationNode.ChildNodes))
            {
                List<string> ddlScripts = new List<string>();

                foreach(IAstNode upgradeNode in GetNode(versionNode, migrationMode).ChildNodes)
                {
                    DbStatementBatchWriter batchWriter = new DbStatementBatchWriter();

                    IDbScriptGenerator scriptGenerator = dbPlatform.Dialect.CreateScriptGenerator(batchWriter);
                    scriptGenerator.SetMigrationMode(migrationMode);
                    //scriptGenerator.SetEnvironment(Environment);
                    scriptGenerator.SetNativeSqlResourceProvider(nativeSqlResourceProvider);

                    upgradeNode.Accept(scriptGenerator);

                    ddlScripts.AddRange(batchWriter.GetStatementBatches());
                } // foreach

                migrationScripts.Add(new MigrationScript(versionNode.Number, ddlScripts.ToArray()));
            } // foreach
        }
 /// <summary>
 /// Visits the given <paramref name="migrationNode"/>.
 /// </summary>
 /// <param name="migrationNode"></param>
 public override void Visit(IMigrationNode migrationNode)
 {
     Visit(migrationNode.ChildNodes);
 }