sql for probes

This commit is contained in:
Martin Rotter 2023-08-04 14:11:31 +02:00
parent 68bc0ac536
commit 62a36197e4
7 changed files with 31 additions and 5 deletions

View File

@ -6,6 +6,7 @@
<file>sql/db_update_mysql_3_4.sql</file>
<file>sql/db_update_mysql_4_5.sql</file>
<file>sql/db_update_mysql_5_6.sql</file>
<file>sql/db_update_mysql_6_7.sql</file>
<file>sql/db_init_sqlite.sql</file>
<file>sql/db_update_sqlite_1_2.sql</file>
@ -13,5 +14,6 @@
<file>sql/db_update_sqlite_3_4.sql</file>
<file>sql/db_update_sqlite_4_5.sql</file>
<file>sql/db_update_sqlite_5_6.sql</file>
<file>sql/db_update_sqlite_6_7.sql</file>
</qresource>
</RCC>

View File

@ -101,3 +101,13 @@ CREATE TABLE Labels (
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
);
-- !
CREATE TABLE Probes (
id $$,
name TEXT NOT NULL CHECK (name != ''),
color VARCHAR(7) NOT NULL CHECK (color != ''),
fltr TEXT NOT NULL CHECK (filter != ''), /* Regular expression. */
account_id INTEGER NOT NULL,
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
);

View File

@ -5,4 +5,3 @@ SET FOREIGN_KEY_CHECKS = 0;
!! db_update_sqlite_3_4.sql
-- !
SET FOREIGN_KEY_CHECKS = 1;
-- !

View File

@ -5,4 +5,3 @@ SET FOREIGN_KEY_CHECKS = 0;
!! db_update_sqlite_5_6.sql
-- !
SET FOREIGN_KEY_CHECKS = 1;
-- !

View File

@ -0,0 +1,7 @@
USE ##;
-- !
SET FOREIGN_KEY_CHECKS = 0;
-- !
!! db_update_sqlite_6_7.sql
-- !
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -0,0 +1,9 @@
CREATE TABLE Probes (
id $$,
name TEXT NOT NULL CHECK (name != ''),
color VARCHAR(7) NOT NULL CHECK (color != ''),
fltr TEXT NOT NULL CHECK (filter != ''), /* Regular expression. */
account_id INTEGER NOT NULL,
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
);

View File

@ -215,7 +215,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 "6"
#define APP_DB_SCHEMA_VERSION "7"
#define APP_DB_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql"
#define APP_DB_COMMENT_SPLIT "-- !\n"
#define APP_DB_INCLUDE_PLACEHOLDER "!!"