~aleteoryx/muditaos

ref: 26ab21212e90f3233c0c0c0928c5496149bc181f muditaos/module-services/service-db/agents/settings/settings.sql -rw-r--r-- 1.1 KiB
26ab2121 — RobertPiet [EGD-3800] settings api and test initial version, unit tests, reviews 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--x, R"dbInitStr( 
/*
 * Create Settings tables
 */


BEGIN TRANSACTION;
--
-- Main settings table, for string application persistent data
--
CREATE TABLE IF NOT EXISTS settings_tab (
    path TEXT NOT NULL UNIQUE,
    value TEXT
);


--
-- Dictionary table, for variables with fixed set of values
--
CREATE TABLE IF NOT EXISTS dictionary_tab (
    id INTEGER PRIMARY KEY,
    path TEXT NOT NULL,
    value TEXT,
    CONSTRAINT dictionary_unique
       UNIQUE (path, value) ON CONFLICT REPLACE
    );

--
-- Table contains information who to inform
-- about changes in values.
--
CREATE TABLE IF NOT EXISTS notifications_tab (
    id INTEGER PRIMARY KEY,
    path TEXT NOT NULL,
    service TEXT,
    CONSTRAINT notification_unique
        UNIQUE(path, service)
    );

-- ----------- insert default values ----------------------
INSERT OR REPLACE INTO dictionary_tab (path, value) VALUES
    ('system/phone_mode', 'online'),
    ('system/phone_mode', 'offline'),
    ('system/phone_mode', 'dnd');

INSERT OR REPLACE INTO settings_tab (path, value) VALUES
    ('system/phone_mode', 'online');

COMMIT TRANSACTION;
-- )dbInitStr"