2016-05-20 Fred Gleason <fredg@paravelsystems.com>

* Removed the 'not null' attribute from the 'LOGS.LINK_DATETIME',
	'LOGS.START_DATE' and 'LOGS.END_DATE' fields in the database
	[GitHub issue #000121].
	* Incremented the database version to 257.
This commit is contained in:
Fred Gleason 2016-05-20 16:45:56 -04:00
parent 5d0ee9cd38
commit db9da6dc62
5 changed files with 52 additions and 6 deletions

View File

@ -15150,3 +15150,8 @@
2016-05-20 Fred Gleason <fredg@paravelsystems.com> 2016-05-20 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'rdadmin/createdb.cpp' that caused creation * Fixed a bug in 'rdadmin/createdb.cpp' that caused creation
of a new DB to fail. of a new DB to fail.
2016-05-20 Fred Gleason <fredg@paravelsystems.com>
* Removed the 'not null' attribute from the 'LOGS.LINK_DATETIME',
'LOGS.START_DATE' and 'LOGS.END_DATE' fields in the database
[GitHub issue #000121].
* Incremented the database version to 257.

View File

@ -24,7 +24,7 @@
/* /*
* Current Database Version * Current Database Version
*/ */
#define RD_VERSION_DATABASE 256 #define RD_VERSION_DATABASE 257
#endif // DBVERSION_H #endif // DBVERSION_H

View File

@ -1197,11 +1197,11 @@ bool CreateDb(QString name,QString pwd)
DESCRIPTION CHAR(64),\ DESCRIPTION CHAR(64),\
ORIGIN_USER CHAR(255) NOT NULL,\ ORIGIN_USER CHAR(255) NOT NULL,\
ORIGIN_DATETIME DATETIME NOT NULL,\ ORIGIN_DATETIME DATETIME NOT NULL,\
LINK_DATETIME DATETIME NOT NULL,\ LINK_DATETIME DATETIME,\
MODIFIED_DATETIME DATETIME NOT NULL,\ MODIFIED_DATETIME DATETIME NOT NULL,\
AUTO_REFRESH enum('N','Y') default 'N',\ AUTO_REFRESH enum('N','Y') default 'N',\
START_DATE DATE NOT NULL,\ START_DATE DATE,\
END_DATE DATE NOT NULL,\ END_DATE DATE,\
PURGE_DATE date,\ PURGE_DATE date,\
IMPORT_DATE date,\ IMPORT_DATE date,\
SCHEDULED_TRACKS int unsigned default 0,\ SCHEDULED_TRACKS int unsigned default 0,\
@ -2627,8 +2627,9 @@ bool InitDb(QString name,QString pwd,QString station_name)
if(!RunQuery(sql)) { if(!RunQuery(sql)) {
return false; return false;
} }
sql="insert into LOGS (NAME,SERVICE,DESCRIPTION,ORIGIN_USER,ORIGIN_DATETIME)\ sql=QString("insert into LOGS ")+
values (\"SAMPLE\",\"Production\",\"Sample Log\",\"user\",NOW())"; "(NAME,SERVICE,DESCRIPTION,ORIGIN_USER,ORIGIN_DATETIME,MODIFIED_DATETIME) "+
"values (\"SAMPLE\",\"Production\",\"Sample Log\",\"user\",now(),now())";
if(!RunQuery(sql)) { if(!RunQuery(sql)) {
return false; return false;
} }
@ -8222,6 +8223,20 @@ int UpdateDb(int ver)
delete q; delete q;
} }
if(ver<257) {
sql=QString("alter table LOGS modify column LINK_DATETIME datetime");
q=new QSqlQuery(sql);
delete q;
sql=QString("alter table LOGS modify column START_DATE date");
q=new QSqlQuery(sql);
delete q;
sql=QString("alter table LOGS modify column END_DATE date");
q=new QSqlQuery(sql);
delete q;
}
// **** End of version updates **** // **** End of version updates ****

View File

@ -171,6 +171,10 @@ void MainObject::Revert(int schema) const
case 256: case 256:
Revert256(); Revert256();
break; break;
case 257:
Revert257();
break;
} }
} }
@ -427,6 +431,27 @@ void MainObject::Revert256() const
} }
void MainObject::Revert257() const
{
QString sql;
QSqlQuery *q;
sql=QString("alter table LOGS modify column LINK_DATETIME datetime not null");
q=new QSqlQuery(sql);
delete q;
sql=QString("alter table LOGS modify column START_DATE date not null");
q=new QSqlQuery(sql);
delete q;
sql=QString("alter table LOGS modify column END_DATE date not null");
q=new QSqlQuery(sql);
delete q;
SetVersion(256);
}
int MainObject::GetVersion() const int MainObject::GetVersion() const
{ {
QString sql; QString sql;

View File

@ -52,6 +52,7 @@ class MainObject : public QObject
void Revert254() const; void Revert254() const;
void Revert255() const; void Revert255() const;
void Revert256() const; void Revert256() const;
void Revert257() const;
int GetVersion() const; int GetVersion() const;
void SetVersion(int schema) const; void SetVersion(int schema) const;
int MapSchema(const QString &ver); int MapSchema(const QString &ver);