Esempio n. 1
0
        public override SQLScriptList ToSqlDiff()
        {
            SQLScriptList list = new SQLScriptList();

            if (Status != Enums.ObjectStatusType.OriginalStatus)
            {
                RootParent.ActionMessage[Parent.FullName].Add(this);
            }

            if (HasState(Enums.ObjectStatusType.DropStatus))
            {
                list.Add(Drop());
            }
            if (HasState(Enums.ObjectStatusType.CreateStatus))
            {
                list.Add(Create());
            }
            if (HasState(Enums.ObjectStatusType.AlterStatus))
            {
                list.Add(Drop());
                list.Add(Create());
            }
            if (Status == Enums.ObjectStatusType.DisabledStatus)
            {
                list.Add(ToSqlEnabled(), Parent.DependenciesCount, Enums.ScripActionType.AlterIndex);
            }

            /*if (this.Status == StatusEnum.ObjectStatusType.ChangeFileGroup)
             * {
             *  listDiff.Add(this.ToSQLDrop(this.FileGroup), ((Table)Parent).DependenciesCount, StatusEnum.ScripActionType.DropIndex);
             *  listDiff.Add(this.ToSQLAdd(), ((Table)Parent).DependenciesCount, StatusEnum.ScripActionType.AddIndex);
             * }*/
            list.AddRange(ExtendedProperties.ToSqlDiff());
            return(list);
        }
Esempio n. 2
0
        public override SQLScriptList ToSqlDiff(System.Collections.Generic.ICollection <ISchemaBase> schemas)
        {
            SQLScriptList list = new SQLScriptList();

            if (Status != ObjectStatus.Original)
            {
                var actionMessage = RootParent.ActionMessage[Parent.FullName];
                if (actionMessage != null)
                {
                    actionMessage.Add(this);
                }
            }

            if (HasState(ObjectStatus.Drop))
            {
                list.Add(Drop());
            }
            if (HasState(ObjectStatus.Create))
            {
                list.Add(Create());
            }
            if (HasState(ObjectStatus.Alter))
            {
                list.Add(Drop());
                list.Add(Create());
            }
            if (Status == ObjectStatus.Disabled)
            {
                list.Add(ToSqlEnabled(), Parent.DependenciesCount, ScriptAction.AlterIndex);
            }

            /*if (this.Status == StatusEnum.ObjectStatusType.ChangeFileGroup)
             * {
             *  listDiff.Add(this.ToSQLDrop(this.FileGroup), ((Table)Parent).DependenciesCount, StatusEnum.ScripActionType.DropIndex);
             *  listDiff.Add(this.ToSQLAdd(), ((Table)Parent).DependenciesCount, StatusEnum.ScripActionType.AddIndex);
             * }*/
            list.AddRange(ExtendedProperties.ToSqlDiff());
            return(list);
        }