Ejemplo n.º 1
0
        public DatabaseUpdateResponse CreateCMSDatabase()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            if (!DatabaseUpdate.FailedSQL)
            {
                bool bTestResult = SQLUpdateNugget.EvalNuggetKey("DoCMSTablesExist");

                if (!bTestResult)
                {
                    res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.CREATE01.sql", false);
                    res.Response      = "Created Database";
                    res.RanUpdate     = true;
                    // change version key when the DB creation is rescripted
                    SetDbSchemaVersion(DatabaseUpdate.DbVersion12);
                    return(res);
                }

                res.Response = "Database Already Created";
                return(res);
            }

            res.Response = "*** Database Access Failed ***";
            return(res);
        }
		public ActionResult CalendarDatabase() {
			List<string> lst = new List<string>();

			DatabaseUpdate du = new DatabaseUpdate();
			DatabaseUpdateResponse dbRes = new DatabaseUpdateResponse();

			string sqlUpdate = String.Empty;
			string sqlTest = String.Empty;

			try {
				sqlUpdate = WebHelper.ReadEmbededScript("CarrotCake.CMS.Plugins.CalendarModule.tblCalendar.sql");

				sqlTest = "select * from [INFORMATION_SCHEMA].[COLUMNS] where table_name in('tblCalendar')";
				dbRes = du.ApplyUpdateIfNotFound(sqlTest, sqlUpdate, false);

				if (dbRes.LastException != null && !string.IsNullOrEmpty(dbRes.LastException.Message)) {
					lst.Add(dbRes.LastException.Message);
				} else {
					lst.Add(dbRes.Response);
				}
			} catch (Exception ex) {
				lst.Add(ex.ToString());
			}

			return View(lst);
		}
Ejemplo n.º 3
0
        public DatabaseUpdateResponse AlterStep01()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep01");

            if (bTestResult)
            {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER01.sql", false);
                res.Response      = "Update comment view";
                res.RanUpdate     = true;
                SetDbSchemaVersion(DatabaseUpdate.DbVersion01);
                return(res);
            }
            else
            {
                // if the db version is off, check leading tidbit against current and immediate prior
                DataInfo ver = GetDbSchemaVersion();
                if (DatabaseUpdate.DbVersion00.Substring(0, 6) == ver.DataValue.Substring(0, 6) ||
                    "201510" == ver.DataValue.Substring(0, 6) || "201509" == ver.DataValue.Substring(0, 6) || "201508" == ver.DataValue.Substring(0, 6) ||
                    DatabaseUpdate.DbVersion01.Substring(0, 6) == ver.DataValue.Substring(0, 6))
                {
                    SetDbSchemaVersion(DatabaseUpdate.DbVersion01);
                }
            }

            res.Response = "Comment view update already applied";
            return(res);
        }
Ejemplo n.º 4
0
        public DatabaseUpdateResponse AlterStep13()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep13");

            if (bTestResult)
            {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER13.sql", false);
                res.Response      = "Update timezone sproc";
                res.RanUpdate     = true;
                SetDbSchemaVersion(DatabaseUpdate.DbVersion13);
                return(res);
            }
            else
            {
                // if the db version is off, check leading tidbit against current and immediate prior
                DataInfo ver = GetDbSchemaVersion();

                if (DatabaseUpdate.DbVersion12.Substring(0, 6) == ver.DataValue.Substring(0, 6))
                {
                    SetDbSchemaVersion(DatabaseUpdate.DbVersion13);
                }
            }

            res.Response = "Timezone sproc update already applied";
            return(res);
        }
Ejemplo n.º 5
0
        public List <DatabaseUpdateMessage> HandleResponse(List <DatabaseUpdateMessage> lstMsgs, Exception ex)
        {
            if (lstMsgs == null)
            {
                lstMsgs = new List <DatabaseUpdateMessage>();
            }

            DatabaseUpdateResponse execMessage = new DatabaseUpdateResponse();

            execMessage.LastException = ex;
            execMessage.Response      = "An error occurred.";

            HandleResponse(lstMsgs, "Error: ", execMessage);

            return(lstMsgs);
        }
Ejemplo n.º 6
0
        public DatabaseUpdateResponse ApplyUpdateIfFound(string testQuery, string updateStatement, bool bIgnore)
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();
            DataTable table1           = GetTestData(testQuery);

            if (table1.Rows.Count > 0)
            {
                res.LastException = ExecScriptContents(updateStatement, bIgnore);
                res.Response      = "Applied update";
                res.RanUpdate     = true;
                return(res);
            }

            res.Response = "Did not apply any updates";
            return(res);
        }
Ejemplo n.º 7
0
        public DatabaseUpdateResponse AlterStep01()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep01");

            if (bTestResult)
            {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER01.sql", false);
                res.Response      = "Created Content MetaKeyword and MetaDescription";
                res.RanUpdate     = true;
                return(res);
            }

            res.Response = "Content MetaKeyword and MetaDescription Already Exists";
            return(res);
        }
Ejemplo n.º 8
0
        public DatabaseUpdateResponse AlterStep03()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep03");

            if (bTestResult)
            {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER03.sql", false);
                res.Response      = "RootContent CreateDate Created";
                res.RanUpdate     = true;
                return(res);
            }

            res.Response = "RootContent CreateDate Already Exists";
            return(res);
        }
Ejemplo n.º 9
0
        public DatabaseUpdateResponse AlterStep04()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep04");

            if (bTestResult)
            {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER04.sql", false);
                res.Response      = "CMS Table Names Changed";
                res.RanUpdate     = true;
                return(res);
            }

            res.Response = "CMS Tables Already Changed";
            return(res);
        }
Ejemplo n.º 10
0
        public DatabaseUpdateResponse AlterStep06()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep06");

            if (bTestResult)
            {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER06.sql", false);
                res.Response      = "CMS DB created carrot_ContentType, carrot_ContentTag, carrot_ContentCategory";
                res.RanUpdate     = true;
                return(res);
            }

            res.Response = "CMS DB carrot_ContentType, carrot_ContentTag, carrot_ContentCategory already exist";
            return(res);
        }
Ejemplo n.º 11
0
        public DatabaseUpdateResponse AlterStep07()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep07");

            if (bTestResult)
            {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER07.sql", false);
                res.Response      = "CMS DB created cols RetireDate, GoLiveDate, and GoLiveDateLocal in carrot_RootContent";
                res.RanUpdate     = true;
                return(res);
            }

            res.Response = "CMS DB cols RetireDate, GoLiveDate, and GoLiveDateLocal in carrot_RootContent already exist";
            return(res);
        }
Ejemplo n.º 12
0
        public DatabaseUpdateResponse AlterStep09()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep09");

            if (bTestResult)
            {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER09.sql", false);
                res.Response      = "CMS DB created vw_carrot_ContentChild and ShowInSiteNav";
                res.RanUpdate     = true;
                return(res);
            }

            res.Response = "CMS DB vw_carrot_ContentChild and ShowInSiteNav already exist";
            return(res);
        }
Ejemplo n.º 13
0
        public DatabaseUpdateResponse AlterStep10()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep10");

            if (bTestResult)
            {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER10.sql", false);
                res.Response      = "CMS DB created TextWidget and Content Snippet, updated edit history";
                res.RanUpdate     = true;
                SetDbSchemaVersion(DatabaseUpdate.DbVersion10);
                return(res);
            }

            res.Response = "CMS DB TextWidget and Content Snippet already exist";
            return(res);
        }
Ejemplo n.º 14
0
        public DatabaseUpdateResponse AlterStep12()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep12");

            if (bTestResult)
            {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER12.sql", false);
                res.Response      = "CMS DB Updated time zone sproc and tallies";
                res.RanUpdate     = true;
                SetDbSchemaVersion(DatabaseUpdate.DbVersion12);
                return(res);
            }

            res.Response = "CMS DB time zone sproc already updated";
            return(res);
        }
		protected void Page_Load(object sender, EventArgs e) {
			DatabaseUpdate du = new DatabaseUpdate();
			DatabaseUpdateResponse dbRes = new DatabaseUpdateResponse();
			string sqlUpdate = "";
			string sqlTest = "";
			int iCt = 0;
			litMsg.Text = "";

			sqlUpdate = ReadEmbededScript("Carrotware.CMS.UI.Plugins.EventCalendarModule.carrot_CalendarEvent.sql");
			sqlTest = "select * from information_schema.columns where table_name = 'carrot_CalendarEventProfile' and column_name = 'RecursEvery'";
			dbRes = du.ApplyUpdateIfNotFound(sqlTest, sqlUpdate, false);
			iCt++;

			if (dbRes.LastException != null && !string.IsNullOrEmpty(dbRes.LastException.Message)) {
				litMsg.Text += iCt.ToString() + ")  " + dbRes.LastException.Message + "<br />";
			} else {
				litMsg.Text += iCt.ToString() + ")  " + dbRes.Response + "<br />";
			}
		}
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DatabaseUpdate du = new DatabaseUpdate();
            DatabaseUpdateResponse dbRes = new DatabaseUpdateResponse();
            string sqlUpdate = "";
            string sqlTest = "";
            int iCt = 0;
            litMsg.Text = "";

            sqlUpdate = ReadEmbededScript("Carrotware.CMS.UI.Plugins.FAQ2Module.carrot_FaqItem.sql");
            sqlTest = "select * from [INFORMATION_SCHEMA].[COLUMNS] where table_name in('carrot_FaqItem')";
            dbRes = du.ApplyUpdateIfNotFound(sqlTest, sqlUpdate, false);
            iCt++;

            if (dbRes.LastException != null && !string.IsNullOrEmpty(dbRes.LastException.Message)) {
                litMsg.Text += iCt.ToString() + ")  " + dbRes.LastException.Message + "<br />";
            } else {
                litMsg.Text += iCt.ToString() + ")  " + dbRes.Response + "<br />";
            }
        }
		protected void Page_Load(object sender, EventArgs e) {
			DatabaseUpdate du = new DatabaseUpdate();
			DatabaseUpdateResponse dbRes = new DatabaseUpdateResponse();
			string sqlUpdate = "";
			string sqlTest = "";
			int iCt = 0;
			litMsg.Text = "";

			sqlUpdate = ReadEmbededScript("Carrotware.CMS.UI.Plugins.PhotoGallery.tblGallery.sql");

			sqlTest = "select * from [information_schema].[columns] where table_name in('tblGalleryImageMeta')";
			dbRes = du.ApplyUpdateIfNotFound(sqlTest, sqlUpdate, false);
			iCt++;

			if (dbRes.LastException != null && !string.IsNullOrEmpty(dbRes.LastException.Message)) {
				litMsg.Text += iCt.ToString() + ")  " + dbRes.LastException.Message + "<br />";
			} else {
				litMsg.Text += iCt.ToString() + ")  " + dbRes.Response + "<br />";
			}

		}
Ejemplo n.º 18
0
        public ActionResult GalleryDatabase()
        {
            List<string> lst = new List<string>();

            DatabaseUpdate du = new DatabaseUpdate();
            DatabaseUpdateResponse dbRes = new DatabaseUpdateResponse();
            string sqlUpdate = "";
            string sqlTest = "";
            try {
                sqlUpdate = GalleryHelper.ReadEmbededScript("CarrotCake.CMS.Plugins.PhotoGallery.tblGallery.sql");

                sqlTest = "select * from [information_schema].[columns] where table_name in('tblGalleryImageMeta')";
                dbRes = du.ApplyUpdateIfNotFound(sqlTest, sqlUpdate, false);

                if (dbRes.LastException != null && !string.IsNullOrEmpty(dbRes.LastException.Message)) {
                    lst.Add(dbRes.LastException.Message);
                } else {
                    lst.Add(dbRes.Response);
                }
            } catch (Exception ex) {
                lst.Add(ex.ToString());
            }

            return View(lst);
        }
Ejemplo n.º 19
0
        public DatabaseUpdateResponse AlterStep01()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep01");

            if (bTestResult) {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER01.sql", false);
                res.Response = "Created Content MetaKeyword and MetaDescription";
                res.RanUpdate = true;
                return res;
            }

            res.Response = "Content MetaKeyword and MetaDescription Already Exists";
            return res;
        }
Ejemplo n.º 20
0
        public DatabaseUpdateResponse AlterStep03()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep03");

            if (bTestResult) {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER03.sql", false);
                res.Response = "RootContent CreateDate Created";
                res.RanUpdate = true;
                return res;
            }

            res.Response = "RootContent CreateDate Already Exists";
            return res;
        }
Ejemplo n.º 21
0
        public DatabaseUpdateResponse AlterStep04()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep04");

            if (bTestResult) {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER04.sql", false);
                res.Response = "CMS Table Names Changed";
                res.RanUpdate = true;
                return res;
            }

            res.Response = "CMS Tables Already Changed";
            return res;
        }
Ejemplo n.º 22
0
        public DatabaseUpdateResponse AlterStep06()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep06");

            if (bTestResult) {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER06.sql", false);
                res.Response = "CMS DB created carrot_ContentType, carrot_ContentTag, carrot_ContentCategory";
                res.RanUpdate = true;
                return res;
            }

            res.Response = "CMS DB carrot_ContentType, carrot_ContentTag, carrot_ContentCategory already exist";
            return res;
        }
Ejemplo n.º 23
0
        public DatabaseUpdateResponse AlterStep07()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep07");

            if (bTestResult) {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER07.sql", false);
                res.Response = "CMS DB created cols RetireDate, GoLiveDate, and GoLiveDateLocal in carrot_RootContent";
                res.RanUpdate = true;
                return res;
            }

            res.Response = "CMS DB cols RetireDate, GoLiveDate, and GoLiveDateLocal in carrot_RootContent already exist";
            return res;
        }
Ejemplo n.º 24
0
        public DatabaseUpdateResponse AlterStep01()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep01");

            if (bTestResult) {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER01.sql", false);
                res.Response = "Update comment view";
                res.RanUpdate = true;
                SetDbSchemaVersion(DatabaseUpdate.DbVersion01);
                return res;
            }

            res.Response = "Comment view update already applied";
            return res;
        }
Ejemplo n.º 25
0
        public DatabaseUpdateResponse AlterStep10()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep10");

            if (bTestResult) {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER10.sql", false);
                res.Response = "CMS DB created TextWidget and Content Snippet, updated edit history";
                res.RanUpdate = true;
                SetDbSchemaVersion(DatabaseUpdate.DbVersion10);
                return res;
            }

            res.Response = "CMS DB TextWidget and Content Snippet already exist";
            return res;
        }
Ejemplo n.º 26
0
        public List <DatabaseUpdateMessage> HandleResponse(List <DatabaseUpdateMessage> lstMsgs, string sMsg, DatabaseUpdateResponse execMessage)
        {
            if (lstMsgs == null)
            {
                lstMsgs = new List <DatabaseUpdateMessage>();
            }

            DatabaseUpdateMessage item = new DatabaseUpdateMessage();

            if (!string.IsNullOrEmpty(sMsg))
            {
                item.Message = sMsg;

                if (execMessage != null)
                {
                    item.AlteredData = execMessage.RanUpdate;
                    item.Response    = execMessage.Response;

                    if (execMessage.LastException != null && !string.IsNullOrEmpty(execMessage.LastException.Message))
                    {
                        item.HasException  = true;
                        item.ExceptionText = execMessage.LastException.Message;
                        if (execMessage.LastException.InnerException != null && !string.IsNullOrEmpty(execMessage.LastException.InnerException.Message))
                        {
                            item.InnerExceptionText = execMessage.LastException.InnerException.Message;
                        }
                    }
                }
            }

            item.Order = lstMsgs.Count + 1;

            lstMsgs.Add(item);

            return(lstMsgs);
        }
Ejemplo n.º 27
0
        public DatabaseUpdateResponse AlterStep11()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep11");

            if (bTestResult) {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER11.sql", false);
                res.Response = "CMS DB Updated archive tally";
                res.RanUpdate = true;
                SetDbSchemaVersion(DatabaseUpdate.DbVersion11);
                return res;
            }

            res.Response = "CMS DB archive tally already updated";
            return res;
        }
Ejemplo n.º 28
0
        public DatabaseUpdateResponse AlterStep12()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep12");

            if (bTestResult) {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER12.sql", false);
                res.Response = "CMS DB Updated time zone sproc and tallies";
                res.RanUpdate = true;
                SetDbSchemaVersion(DatabaseUpdate.DbVersion12);
                return res;
            }

            res.Response = "CMS DB time zone sproc already updated";
            return res;
        }
Ejemplo n.º 29
0
        public List<DatabaseUpdateMessage> HandleResponse(List<DatabaseUpdateMessage> lstMsgs, string sMsg, DatabaseUpdateResponse execMessage)
        {
            if (lstMsgs == null) {
                lstMsgs = new List<DatabaseUpdateMessage>();
            }

            DatabaseUpdateMessage item = new DatabaseUpdateMessage();

            if (!String.IsNullOrEmpty(sMsg)) {
                item.Message = sMsg;

                if (execMessage != null) {
                    item.AlteredData = execMessage.RanUpdate;
                    item.Response = execMessage.Response;

                    if (execMessage.LastException != null && !String.IsNullOrEmpty(execMessage.LastException.Message)) {
                        item.HasException = true;
                        item.ExceptionText = execMessage.LastException.Message;
                        if (execMessage.LastException.InnerException != null && !String.IsNullOrEmpty(execMessage.LastException.InnerException.Message)) {
                            item.InnerExceptionText = execMessage.LastException.InnerException.Message;
                        }
                    }
                }
            }

            item.Order = lstMsgs.Count + 1;

            lstMsgs.Add(item);

            return lstMsgs;
        }
Ejemplo n.º 30
0
        public List<DatabaseUpdateMessage> HandleResponse(List<DatabaseUpdateMessage> lstMsgs, Exception ex)
        {
            if (lstMsgs == null) {
                lstMsgs = new List<DatabaseUpdateMessage>();
            }

            DatabaseUpdateResponse execMessage = new DatabaseUpdateResponse();
            execMessage.LastException = ex;
            execMessage.Response = "An error occurred.";

            HandleResponse(lstMsgs, "Error: ", execMessage);

            return lstMsgs;
        }
Ejemplo n.º 31
0
        public DatabaseUpdateResponse CreateCMSDatabase()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            if (!DatabaseUpdate.FailedSQL) {
                bool bTestResult = SQLUpdateNugget.EvalNuggetKey("DoCMSTablesExist");

                if (!bTestResult) {
                    res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.CREATE01.sql", false);
                    res.Response = "Created Database";
                    res.RanUpdate = true;
                    // change version key when the DB creation is re-scripted
                    SetDbSchemaVersion(DatabaseUpdate.DbVersion01);
                    return res;
                }

                res.Response = "Database Already Created";
                return res;
            }

            res.Response = "*** Database Access Failed ***";
            return res;
        }
Ejemplo n.º 32
0
        public DatabaseUpdateResponse AlterStep09()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep09");

            if (bTestResult) {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER09.sql", false);
                res.Response = "CMS DB created vw_carrot_ContentChild and ShowInSiteNav";
                res.RanUpdate = true;
                return res;
            }

            res.Response = "CMS DB vw_carrot_ContentChild and ShowInSiteNav already exist";
            return res;
        }
Ejemplo n.º 33
0
        public DatabaseUpdateResponse ApplyUpdateIfNotFound(string testQuery, string updateStatement, bool bIgnore)
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();
            DataTable table1 = GetTestData(testQuery);

            if (table1.Rows.Count < 1) {
                res.LastException = ExecScriptContents(updateStatement, bIgnore);
                res.Response = "Applied update";
                res.RanUpdate = true;
                return res;
            }

            res.Response = "Did not apply any updates";
            return res;
        }
Ejemplo n.º 34
0
        public DatabaseUpdateResponse AlterStep01()
        {
            DatabaseUpdateResponse res = new DatabaseUpdateResponse();

            bool bTestResult = SQLUpdateNugget.EvalNuggetKey("AlterStep01");

            if (bTestResult) {
                res.LastException = ExecFileContents("Carrotware.CMS.DBUpdater.DataScripts.ALTER01.sql", false);
                res.Response = "Update comment view";
                res.RanUpdate = true;
                SetDbSchemaVersion(DatabaseUpdate.DbVersion01);
                return res;
            } else {
                // if the db version is off, check leading tidbit against current and immediate prior
                DataInfo ver = GetDbSchemaVersion();
                if (DatabaseUpdate.DbVersion00.Substring(0, 6) == ver.DataValue.Substring(0, 6)
                    || "201510" == ver.DataValue.Substring(0, 6) || "201509" == ver.DataValue.Substring(0, 6) || "201508" == ver.DataValue.Substring(0, 6)
                    || DatabaseUpdate.DbVersion01.Substring(0, 6) == ver.DataValue.Substring(0, 6)) {
                    SetDbSchemaVersion(DatabaseUpdate.DbVersion01);
                }
            }

            res.Response = "Comment view update already applied";
            return res;
        }