mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
resort db tables creation
This commit is contained in:
parent
e130698ee9
commit
b8031268d0
@ -126,21 +126,7 @@ bool DataBaseManagement::createTables(QSqlDatabase & database)
|
|||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
//FOLDER (representa una carpeta en disco)
|
|
||||||
{
|
{
|
||||||
QSqlQuery queryFolder(database);
|
|
||||||
queryFolder.prepare("CREATE TABLE folder ("
|
|
||||||
"id INTEGER PRIMARY KEY,"
|
|
||||||
"parentId INTEGER NOT NULL,"
|
|
||||||
"name TEXT NOT NULL,"
|
|
||||||
"path TEXT NOT NULL,"
|
|
||||||
//new 7.1 fields
|
|
||||||
"finished BOOLEAN DEFAULT 0," //reading
|
|
||||||
"completed BOOLEAN DEFAULT 1," //collecting
|
|
||||||
//--
|
|
||||||
"FOREIGN KEY(parentId) REFERENCES folder(id) ON DELETE CASCADE)");
|
|
||||||
success = success && queryFolder.exec();
|
|
||||||
|
|
||||||
//COMIC INFO (representa la información de un cómic, cada cómic tendrá un idéntificador único formado por un hash sha1'de los primeros 512kb' + su tamaño en bytes)
|
//COMIC INFO (representa la información de un cómic, cada cómic tendrá un idéntificador único formado por un hash sha1'de los primeros 512kb' + su tamaño en bytes)
|
||||||
QSqlQuery queryComicInfo(database);
|
QSqlQuery queryComicInfo(database);
|
||||||
queryComicInfo.prepare("CREATE TABLE comic_info ("
|
queryComicInfo.prepare("CREATE TABLE comic_info ("
|
||||||
@ -199,6 +185,20 @@ bool DataBaseManagement::createTables(QSqlDatabase & database)
|
|||||||
success = success && queryComicInfo.exec();
|
success = success && queryComicInfo.exec();
|
||||||
//queryComicInfo.finish();
|
//queryComicInfo.finish();
|
||||||
|
|
||||||
|
//FOLDER (representa una carpeta en disco)
|
||||||
|
QSqlQuery queryFolder(database);
|
||||||
|
queryFolder.prepare("CREATE TABLE folder ("
|
||||||
|
"id INTEGER PRIMARY KEY,"
|
||||||
|
"parentId INTEGER NOT NULL,"
|
||||||
|
"name TEXT NOT NULL,"
|
||||||
|
"path TEXT NOT NULL,"
|
||||||
|
//new 7.1 fields
|
||||||
|
"finished BOOLEAN DEFAULT 0," //reading
|
||||||
|
"completed BOOLEAN DEFAULT 1," //collecting
|
||||||
|
//--
|
||||||
|
"FOREIGN KEY(parentId) REFERENCES folder(id) ON DELETE CASCADE)");
|
||||||
|
success = success && queryFolder.exec();
|
||||||
|
|
||||||
//COMIC (representa un cómic en disco, contiene el nombre de fichero)
|
//COMIC (representa un cómic en disco, contiene el nombre de fichero)
|
||||||
QSqlQuery queryComic(database);
|
QSqlQuery queryComic(database);
|
||||||
queryComic.prepare("CREATE TABLE comic (id INTEGER PRIMARY KEY, parentId INTEGER NOT NULL, comicInfoId INTEGER NOT NULL, fileName TEXT NOT NULL, path TEXT, FOREIGN KEY(parentId) REFERENCES folder(id) ON DELETE CASCADE, FOREIGN KEY(comicInfoId) REFERENCES comic_info(id))");
|
queryComic.prepare("CREATE TABLE comic (id INTEGER PRIMARY KEY, parentId INTEGER NOT NULL, comicInfoId INTEGER NOT NULL, fileName TEXT NOT NULL, path TEXT, FOREIGN KEY(parentId) REFERENCES folder(id) ON DELETE CASCADE, FOREIGN KEY(comicInfoId) REFERENCES comic_info(id))");
|
||||||
@ -216,7 +216,6 @@ bool DataBaseManagement::createTables(QSqlDatabase & database)
|
|||||||
|
|
||||||
//8.0> tables
|
//8.0> tables
|
||||||
success = success && DataBaseManagement::createV8Tables(database);
|
success = success && DataBaseManagement::createV8Tables(database);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user