public DatabaseUpdateStatus PerformUpdates()
        {
            DatabaseUpdateStatus status = new DatabaseUpdateStatus();

            bool bUpdate = true;
            List <DatabaseUpdateMessage> lst = new List <DatabaseUpdateMessage>();

            if (!DoCMSTablesExist())
            {
                HandleResponse(lst, "Create Database", CreateCMSDatabase());
            }
            else
            {
                HandleResponse(lst, "Database already exists");
            }

            bUpdate = DatabaseNeedsUpdate();

            DataInfo ver = GetDbSchemaVersion();

            int iUpdate = 1;

            if (bUpdate || (ver.DataValue != DatabaseUpdate.CurrentDbVersion))
            {
                if (ver.DataValue != DatabaseUpdate.CurrentDbVersion)
                {
                    ver = GetDbSchemaVersion();

                    if (ver.DataValue != DatabaseUpdate.CurrentDbVersion)
                    {
                        ver = GetDbSchemaVersion();
                        if (ver.DataValue == DatabaseUpdate.DbVersion00 || ver.DataValue.StartsWith("201508") ||
                            ver.DataValue.StartsWith("201509") || ver.DataValue.StartsWith("201510"))
                        {
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep01());
                        }
                    }
                }
                else
                {
                    HandleResponse(lst, "Database up-to-date [" + ver.DataValue + "] ");
                }
            }
            else
            {
                HandleResponse(lst, "Database up-to-date [" + ver.DataValue + "] ");
            }

            ResetFailedSQL();

            ResetSQLState();

            bUpdate = DatabaseNeedsUpdate();

            status.NeedsUpdate = bUpdate;
            status.Messages    = lst;

            return(status);
        }
        public DatabaseUpdateStatus PerformUpdates()
        {
            DatabaseUpdateStatus status = new DatabaseUpdateStatus();
            bool bUpdate = true;
            List <DatabaseUpdateMessage> lst = new List <DatabaseUpdateMessage>();

            lock (updateLocker) {
                if (!DoCMSTablesExist())
                {
                    HandleResponse(lst, "Create Database", CreateCMSDatabase());
                }
                else
                {
                    HandleResponse(lst, "Database already exists");
                }

                bUpdate = DatabaseNeedsUpdate();

                DataInfo ver = GetDbSchemaVersion();

                int iUpdate = 1;

                if (bUpdate || (ver.DataValue != DatabaseUpdate.CurrentDbVersion))
                {
                    if (ver.DataValue != DatabaseUpdate.CurrentDbVersion)
                    {
                        if (!IsPostStep04)
                        {
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep00());
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep01());
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep02());
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep03());
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep04());
                        }

                        if (!IsPostStep09)
                        {
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep05());
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep06());
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep07());
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep08());
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep09());
                        }

                        ver = GetDbSchemaVersion();

                        if (ver.DataValue != DatabaseUpdate.CurrentDbVersion)
                        {
                            if (ver.DataValue.Length < 2 || ver.DataValue.StartsWith("201305") || ver.DataValue.StartsWith("201306"))
                            {
                                HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep10());
                            }
                            ver = GetDbSchemaVersion();
                            if (ver.DataValue == DatabaseUpdate.DbVersion10 || ver.DataValue.StartsWith("201306") || ver.DataValue.StartsWith("201309"))
                            {
                                HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep11());
                            }
                            ver = GetDbSchemaVersion();
                            if (ver.DataValue == DatabaseUpdate.DbVersion11 || ver.DataValue.StartsWith("2013") || ver.DataValue.StartsWith("201409") || ver.DataValue.StartsWith("201410"))
                            {
                                HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep12());
                            }
                            if (ver.DataValue == DatabaseUpdate.DbVersion12 || ver.DataValue.StartsWith("2013") || ver.DataValue.StartsWith("2014") || ver.DataValue.StartsWith("2015"))
                            {
                                HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep13());
                            }
                        }
                    }
                    else
                    {
                        HandleResponse(lst, "Database up-to-date [" + ver.DataValue + "] ");
                    }
                }
                else
                {
                    HandleResponse(lst, "Database up-to-date [" + ver.DataValue + "] ");
                }

                ResetFailedSQL();

                ResetSQLState();

                bUpdate = DatabaseNeedsUpdate();

                status.NeedsUpdate = bUpdate;
                status.Messages    = lst;
            }

            return(status);
        }
        public DatabaseUpdateStatus PerformUpdates()
        {
            DatabaseUpdateStatus status = new DatabaseUpdateStatus();

            bool bUpdate = true;
            List<DatabaseUpdateMessage> lst = new List<DatabaseUpdateMessage>();

            if (!DoCMSTablesExist()) {
                HandleResponse(lst, "Create Database", CreateCMSDatabase());
            } else {
                HandleResponse(lst, "Database already exists");
            }

            bUpdate = DatabaseNeedsUpdate();

            DataInfo ver = GetDbSchemaVersion();

            int iUpdate = 1;

            if (bUpdate || (ver.DataValue != DatabaseUpdate.CurrentDbVersion)) {
                if (ver.DataValue != DatabaseUpdate.CurrentDbVersion) {
                    ver = GetDbSchemaVersion();

                    if (ver.DataValue != DatabaseUpdate.CurrentDbVersion) {
                        ver = GetDbSchemaVersion();
                        if (ver.DataValue == DatabaseUpdate.DbVersion00 || ver.DataValue.StartsWith("201508")
                                    || ver.DataValue.StartsWith("201509") || ver.DataValue.StartsWith("201510")) {
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep01());
                        }
                    }
                } else {
                    HandleResponse(lst, "Database up-to-date [" + ver.DataValue + "] ");
                }
            } else {
                HandleResponse(lst, "Database up-to-date [" + ver.DataValue + "] ");
            }

            ResetFailedSQL();

            ResetSQLState();

            bUpdate = DatabaseNeedsUpdate();

            status.NeedsUpdate = bUpdate;
            status.Messages = lst;

            return status;
        }
Beispiel #4
0
        public DatabaseUpdateStatus PerformUpdates()
        {
            DatabaseUpdateStatus status = new DatabaseUpdateStatus();

            bool bUpdate = true;
            List<DatabaseUpdateMessage> lst = new List<DatabaseUpdateMessage>();

            if (!DoCMSTablesExist()) {
                HandleResponse(lst, "Create Database", CreateCMSDatabase());
            } else {
                HandleResponse(lst, "Database already exists");
            }

            bUpdate = DatabaseNeedsUpdate();

            DataInfo ver = GetDbSchemaVersion();

            int iUpdate = 1;

            if (bUpdate || (ver.DataValue != DatabaseUpdate.CurrentDbVersion)) {

                if (ver.DataValue != DatabaseUpdate.CurrentDbVersion) {

                    if (!IsPostStep04) {
                        HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep00());
                        HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep01());
                        HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep02());
                        HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep03());
                        HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep04());
                    }

                    if (!IsPostStep09) {
                        HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep05());
                        HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep06());
                        HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep07());
                        HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep08());
                        HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep09());
                    }

                    ver = GetDbSchemaVersion();

                    if (ver.DataValue != DatabaseUpdate.CurrentDbVersion) {
                        if (ver.DataValue.Length < 2 || ver.DataValue.StartsWith("201305") || ver.DataValue.StartsWith("201306")) {
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep10());
                        }
                        ver = GetDbSchemaVersion();
                        if (ver.DataValue == DatabaseUpdate.DbVersion10 || ver.DataValue.StartsWith("201306") || ver.DataValue.StartsWith("201309")) {
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep11());
                        }
                        ver = GetDbSchemaVersion();
                        if (ver.DataValue == DatabaseUpdate.DbVersion11 || ver.DataValue.StartsWith("201309") || ver.DataValue.StartsWith("201409") || ver.DataValue.StartsWith("201410")) {
                            HandleResponse(lst, BuildUpdateString(iUpdate++), AlterStep12());
                        }
                    }

                } else {
                    HandleResponse(lst, "Database up-to-date [" + ver.DataValue + "] ");
                }

            } else {
                HandleResponse(lst, "Database up-to-date [" + ver.DataValue + "] ");
            }

            bUpdate = DatabaseNeedsUpdate();

            status.NeedsUpdate = bUpdate;
            status.Messages = lst;

            return status;
        }