diff --git a/resources/sql/db_init_mysql.sql b/resources/sql/db_init_mysql.sql index 0040d169c..571674cca 100644 --- a/resources/sql/db_init_mysql.sql +++ b/resources/sql/db_init_mysql.sql @@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Information ( inf_value TEXT NOT NULL ); -- ! -INSERT INTO Information VALUES (1, 'schema_version', '6'); +INSERT INTO Information VALUES (1, 'schema_version', '8'); -- ! CREATE TABLE IF NOT EXISTS Accounts ( id INTEGER PRIMARY KEY, @@ -98,5 +98,20 @@ CREATE TABLE IF NOT EXISTS Messages ( custom_id TEXT, custom_hash TEXT, + FOREIGN KEY (account_id) REFERENCES Accounts (id) +); +-- ! +DROP TABLE IF EXISTS Labels; +-- ! +CREATE TABLE IF NOT EXISTS Labels ( + id INTEGER AUTO_INCREMENT PRIMARY KEY, + account_id INTEGER NOT NULL, + color_fg TEXT NOT NULL, + color_bg TEXT NOT NULL, + title TEXT NOT NULL, + description TEXT, + custom_id TEXT, + custom_hash TEXT, + FOREIGN KEY (account_id) REFERENCES Accounts (id) ); \ No newline at end of file diff --git a/resources/sql/db_init_sqlite.sql b/resources/sql/db_init_sqlite.sql index aa4f0aa1f..304c707c8 100644 --- a/resources/sql/db_init_sqlite.sql +++ b/resources/sql/db_init_sqlite.sql @@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS Information ( inf_value TEXT NOT NULL ); -- ! -INSERT INTO Information VALUES (1, 'schema_version', '6'); +INSERT INTO Information VALUES (1, 'schema_version', '8'); -- ! CREATE TABLE IF NOT EXISTS Accounts ( id INTEGER PRIMARY KEY, @@ -93,5 +93,20 @@ CREATE TABLE IF NOT EXISTS Messages ( custom_id TEXT, custom_hash TEXT, + FOREIGN KEY (account_id) REFERENCES Accounts (id) +); +-- ! +DROP TABLE IF EXISTS Labels; +-- ! +CREATE TABLE IF NOT EXISTS Labels ( + id INTEGER PRIMARY KEY, + account_id INTEGER NOT NULL, + color_fg TEXT NOT NULL, + color_bg TEXT NOT NULL, + title TEXT NOT NULL, + description TEXT, + custom_id TEXT, + custom_hash TEXT, + FOREIGN KEY (account_id) REFERENCES Accounts (id) ); \ No newline at end of file diff --git a/resources/sql/db_update_mysql_7_8.sql b/resources/sql/db_update_mysql_7_8.sql new file mode 100755 index 000000000..61d95242f --- /dev/null +++ b/resources/sql/db_update_mysql_7_8.sql @@ -0,0 +1,14 @@ +CREATE TABLE IF NOT EXISTS Labels ( + id INTEGER AUTO_INCREMENT PRIMARY KEY, + account_id INTEGER NOT NULL, + color_fg TEXT NOT NULL, + color_bg TEXT NOT NULL, + title TEXT NOT NULL, + description TEXT, + custom_id TEXT, + custom_hash TEXT, + + FOREIGN KEY (account_id) REFERENCES Accounts (id) +); +-- ! +UPDATE Information SET inf_value = '8' WHERE inf_key = 'schema_version'; \ No newline at end of file diff --git a/resources/sql/db_update_sqlite_7_8.sql b/resources/sql/db_update_sqlite_7_8.sql new file mode 100755 index 000000000..3ef1aa0bb --- /dev/null +++ b/resources/sql/db_update_sqlite_7_8.sql @@ -0,0 +1,14 @@ +CREATE TABLE IF NOT EXISTS Labels ( + id INTEGER PRIMARY KEY, + account_id INTEGER NOT NULL, + color_fg TEXT NOT NULL, + color_bg TEXT NOT NULL, + title TEXT NOT NULL, + description TEXT, + custom_id TEXT, + custom_hash TEXT, + + FOREIGN KEY (account_id) REFERENCES Accounts (id) +); +-- ! +UPDATE Information SET inf_value = '8' WHERE inf_key = 'schema_version'; \ No newline at end of file diff --git a/src/definitions/definitions.h b/src/definitions/definitions.h index 630a1bced..9f76eb882 100755 --- a/src/definitions/definitions.h +++ b/src/definitions/definitions.h @@ -109,7 +109,7 @@ #define APP_DB_SQLITE_FILE "database.db" // Keep this in sync with schema versions declared in SQL initialization code. -#define APP_DB_SCHEMA_VERSION "7" +#define APP_DB_SCHEMA_VERSION "8" #define APP_DB_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql" #define APP_DB_COMMENT_SPLIT "-- !\n" #define APP_DB_NAME_PLACEHOLDER "##" diff --git a/src/gui/settings/settingsdatabase.ui b/src/gui/settings/settingsdatabase.ui index 301d635ad..a40b64879 100755 --- a/src/gui/settings/settingsdatabase.ui +++ b/src/gui/settings/settingsdatabase.ui @@ -23,33 +23,7 @@ 0 - - - - WARNING: Note that switching to another data storage type will NOT copy existing your data from currently active data storage to newly selected one. - - - Qt::AlignCenter - - - true - - - - - - - Note that turning this option ON will make saving of new messages FASTER, but it might rarely cause some issues with messages saving. - - - Qt::AlignHCenter|Qt::AlignTop - - - true - - - - + Database driver @@ -59,10 +33,10 @@ - + - + 1 @@ -287,6 +261,37 @@ Authors of this application are NOT responsible for lost data. + + + + QLabel { + margin-top: 12px; +} + + + WARNING: Note that switching to another data storage type will NOT copy existing your data from currently active data storage to newly selected one. + + + Qt::AlignCenter + + + true + + + + + + + Note that turning this option ON will make saving of new messages FASTER, but it might rarely cause some issues with messages saving. + + + Qt::AlignHCenter|Qt::AlignTop + + + true + + +