- better build script

- initial work on change history support
This commit is contained in:
dmytro.bogovych 2019-06-23 18:46:41 +03:00
parent c5a44ed1cb
commit 1b689eb84d
2 changed files with 46 additions and 5 deletions

View File

@ -2,6 +2,7 @@
#include <QVariant> #include <QVariant>
#include <assert.h> #include <assert.h>
#include <encryption.h> #include <encryption.h>
#include <iostream>
#ifdef TARGET_WIN #ifdef TARGET_WIN
# include <WinSock2.h> # include <WinSock2.h>
@ -124,29 +125,57 @@ bool Storage::create()
} }
catch(std::exception& e) catch(std::exception& e)
{ {
std::cout << e.what() << std::endl;
return false; return false;
} }
#endif #endif
try try
{ {
// Synctime & timestamp are always milliseconds from the start of UNIX epoch.
// Timeline // Timeline
mDatabase->exec("CREATE TABLE timeline (id INTEGER PRIMARY KEY, removed INTEGER, taskid INTEGER, starttime TEXT, endtime TEXT, synctime TEXT)"); mDatabase->exec("CREATE TABLE timeline (id INTEGER PRIMARY KEY, removed INTEGER, "
"taskid INTEGER, starttime TEXT, endtime TEXT, timestamp INTEGER)");
mDatabase->exec("CREATE INDEX timeline_taskid_index ON timeline(taskid ASC)"); mDatabase->exec("CREATE INDEX timeline_taskid_index ON timeline(taskid ASC)");
// Tasks tree // Tasks tree
mDatabase->exec("CREATE TABLE task (type INTEGER, removed INTEGER, modifytime TEXT, id INTEGER PRIMARY KEY, parentid INTEGER, orderid INTEGER, title TEXT, html TEXT, flags INTEGER, synctime1 TEXT, synctime2 TEXT)"); mDatabase->exec("CREATE TABLE task (type INTEGER, removed INTEGER, "
"id INTEGER PRIMARY KEY, parentid INTEGER, orderid INTEGER, title TEXT, html TEXT, "
"flags INTEGER, timestamp INTEGER)");
mDatabase->exec("CREATE INDEX task_parentid_index ON task(parentid ASC)"); mDatabase->exec("CREATE INDEX task_parentid_index ON task(parentid ASC)");
// Tasks history
mDatabase->exec("CREATE TABLE history_task (removed_old INTEGER, removed_new INTEGER, "
"timestamp_old INTEGER, timestamp_new INTEGER, "
"id INTEGER PRIMARY KEY, "
"parent_id_old INTEGER, parent_id_new INTEGER, "
"order_id_old INTEGER, order_id_new INTEGER, "
"diff_title TEXT, diff_html TEXT, "
"flags_old INTEGER, flags_new INTEGER)");
// Attachments // Attachments
mDatabase->exec("CREATE TABLE file (id INTEGER PRIMARY KEY, removed INTEGER, taskid INTEGER, filename TEXT, content BLOB, orderid INTEGER, synctime TEXT)"); mDatabase->exec("CREATE TABLE file (id INTEGER PRIMARY KEY, removed INTEGER, taskid INTEGER, "
"filename TEXT, content BLOB, orderid INTEGER, timestamp INTEGER)");
mDatabase->exec("CREATE TABLE history_file (id INTEGER PRIMARY KEY, "
"removed_old INTEGER, removed_new INTEGER, "
"taskid_old INTEGER, taskid_new INTEGER, "
"filename_old TEXT, filename_new TEXT,"
"content BLOB, "
"order_id_old INTEGER, order_id_new INTEGER, "
"timestamp_old INTEGER, timestamp_new INTEGER)");
mDatabase->exec("CREATE INDEX file_taskid_index ON file(taskid ASC)"); mDatabase->exec("CREATE INDEX file_taskid_index ON file(taskid ASC)");
// Sync status // Sync status
mDatabase->exec("CREATE TABLE syncs (datetime TEXT, status TEXT)"); mDatabase->exec("CREATE TABLE syncs (timestamp INT, status TEXT)");
} }
catch(std::exception& e) catch(std::exception& e)
{ {
std::cerr << e.what() << std::endl;
return false; return false;
} }

View File

@ -28,13 +28,25 @@ if [ "$MAKEBUILD" = "YES" ]; then
echo Running qmake echo Running qmake
QT_BINARY_DIR=/Users/anand/qt/5.12.2/clang_64/bin QT_BINARY_DIR=/Users/anand/qt/5.12.2/clang_64/bin
$QT_BINARY_DIR/qmake chooka.pro $QT_BINARY_DIR/qmake chooka.pro
if [ $? -ne 0 ]; then
echo "qmake failed. Exiting."
exit
fi
echo Building echo Building
make clean make clean
make make
if [ $? -ne 0 ]; then
echo "make failed. Exiting."
exit
fi
echo Deploying Qt libraries echo Deploying Qt libraries
$QT_BINARY_DIR/macdeployqt Litt.app -codesign="$SIGNID" $QT_BINARY_DIR/macdeployqt Litt.app -codesign="$SIGNID"
if [ $? -ne 0 ]; then
echo "macdeployqt failed. Exiting."
exit
fi
echo "Codesign is skipped for now, please purchase a Apple developer subscription!"
#codesign -s $CODESIGN Litt.app #codesign -s $CODESIGN Litt.app
mkdir Chooka.app/Contents/Resources mkdir Chooka.app/Contents/Resources