MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / updateTableStructure

Method updateTableStructure

src/database/WizIndexBase.cpp:144–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144bool WizIndexBase::updateTableStructure(int oldVersion)
145{
146 qDebug() << "table structure version : " << oldVersion << " update to version " << WIZ_TABLE_STRUCTURE_VERSION;
147 if (oldVersion < 1) {
148 if (!m_db.columnExists("WIZ_TAG", "TAG_POS")) {
149 exec("ALTER TABLE 'WIZ_TAG' ADD 'TAG_POS' int64; ");
150 }
151 }
152 //
153 if (oldVersion < 2) {
154 if (!m_db.columnExists("WIZ_MESSAGE", "DELETE_STATUS")) {
155 exec("ALTER TABLE 'WIZ_MESSAGE' ADD 'DELETE_STATUS' int;");
156 }
157 if (!m_db.columnExists("WIZ_MESSAGE", "LOCAL_CHANGED")) {
158 exec("ALTER TABLE 'WIZ_MESSAGE' ADD 'LOCAL_CHANGED' int;");
159 }
160 }
161
162 if (oldVersion < 3) {
163 if (!m_db.columnExists("WIZ_MESSAGE", "MESSAGE_NOTE")) {
164 exec("ALTER TABLE 'WIZ_MESSAGE' ADD 'MESSAGE_NOTE' varchar(2048);");
165 }
166 }
167 //
168 if (oldVersion < 4) {
169 if (!m_db.columnExists("WIZ_DOCUMENT", "INFO_CHANGED")) {
170 exec("ALTER TABLE 'WIZ_DOCUMENT' ADD 'INFO_CHANGED' int default 1;");
171 }
172 if (!m_db.columnExists("WIZ_DOCUMENT", "DATA_CHANGED")) {
173 exec("ALTER TABLE 'WIZ_DOCUMENT' ADD 'DATA_CHANGED' int default 1;");
174 }
175 }
176 //
177 if (oldVersion < 5) {
178 if (!m_db.columnExists("WIZ_DOCUMENT_PARAM", "WIZ_VERSION")) {
179 exec("ALTER TABLE 'WIZ_DOCUMENT_PARAM' ADD 'WIZ_VERSION' int default -1;");
180 }
181 }
182 //
183 return true;
184}
185
186CString WizIndexBase::formatCanonicSQL(const CString& strTableName,
187 const CString& strFieldList,

Callers

nothing calls this directly

Calls 1

columnExistsMethod · 0.80

Tested by

no test coverage detected