New SQL files for labels, tweaked one setting dialog.

This commit is contained in:
martinrotter 2017-03-13 08:02:37 +01:00
parent 898616a38f
commit b921eb5601
6 changed files with 95 additions and 32 deletions

View file

@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Information (
inf_value TEXT NOT NULL 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 ( CREATE TABLE IF NOT EXISTS Accounts (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
@ -98,5 +98,20 @@ CREATE TABLE IF NOT EXISTS Messages (
custom_id TEXT, custom_id TEXT,
custom_hash 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) FOREIGN KEY (account_id) REFERENCES Accounts (id)
); );

View file

@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS Information (
inf_value TEXT NOT NULL 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 ( CREATE TABLE IF NOT EXISTS Accounts (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
@ -93,5 +93,20 @@ CREATE TABLE IF NOT EXISTS Messages (
custom_id TEXT, custom_id TEXT,
custom_hash 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) FOREIGN KEY (account_id) REFERENCES Accounts (id)
); );

View file

@ -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';

View file

@ -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';

View file

@ -109,7 +109,7 @@
#define APP_DB_SQLITE_FILE "database.db" #define APP_DB_SQLITE_FILE "database.db"
// Keep this in sync with schema versions declared in SQL initialization code. // 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_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql"
#define APP_DB_COMMENT_SPLIT "-- !\n" #define APP_DB_COMMENT_SPLIT "-- !\n"
#define APP_DB_NAME_PLACEHOLDER "##" #define APP_DB_NAME_PLACEHOLDER "##"

View file

@ -23,33 +23,7 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0" colspan="2"> <item row="5" column="0">
<widget class="QLabel" name="m_lblDataStorageWarning">
<property name="text">
<string>WARNING: Note that switching to another data storage type will NOT copy existing your data from currently active data storage to newly selected one.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Note that turning this option ON will make saving of new messages FASTER, but it might rarely cause some issues with messages saving.</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="m_lblDatabaseDriver"> <widget class="QLabel" name="m_lblDatabaseDriver">
<property name="text"> <property name="text">
<string>Database driver</string> <string>Database driver</string>
@ -59,10 +33,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="5" column="1">
<widget class="QComboBox" name="m_cmbDatabaseDriver"/> <widget class="QComboBox" name="m_cmbDatabaseDriver"/>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="6" column="0" colspan="2">
<widget class="QStackedWidget" name="m_stackedDatabaseDriver"> <widget class="QStackedWidget" name="m_stackedDatabaseDriver">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>1</number>
@ -287,6 +261,37 @@ Authors of this application are NOT responsible for lost data.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="m_lblDataStorageWarning">
<property name="styleSheet">
<string notr="true">QLabel {
margin-top: 12px;
}</string>
</property>
<property name="text">
<string>WARNING: Note that switching to another data storage type will NOT copy existing your data from currently active data storage to newly selected one.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Note that turning this option ON will make saving of new messages FASTER, but it might rarely cause some issues with messages saving.</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>