diff options
Diffstat (limited to 'src/datastore/datastore-0001.sql')
-rw-r--r-- | src/datastore/datastore-0001.sql | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/datastore/datastore-0001.sql b/src/datastore/datastore-0001.sql new file mode 100644 index 000000000..0d4758be2 --- /dev/null +++ b/src/datastore/datastore-0001.sql | |||
@@ -0,0 +1,49 @@ | |||
1 | -- | ||
2 | -- This file is part of GNUnet | ||
3 | -- Copyright (C) 2014--2022 GNUnet e.V. | ||
4 | -- | ||
5 | -- GNUnet is free software; you can redistribute it and/or modify it under the | ||
6 | -- terms of the GNU General Public License as published by the Free Software | ||
7 | -- Foundation; either version 3, or (at your option) any later version. | ||
8 | -- | ||
9 | -- GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY | ||
10 | -- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
11 | -- A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
12 | -- | ||
13 | -- You should have received a copy of the GNU General Public License along with | ||
14 | -- GNUnet; see the file COPYING. If not, see <http://www.gnu.org/licenses/> | ||
15 | -- | ||
16 | |||
17 | -- Everything in one big transaction | ||
18 | BEGIN; | ||
19 | |||
20 | -- Check patch versioning is in place. | ||
21 | SELECT _v.register_patch('datastore-0001', NULL, NULL); | ||
22 | |||
23 | -------------------- Schema ---------------------------- | ||
24 | |||
25 | CREATE SCHEMA datastore; | ||
26 | COMMENT ON SCHEMA datastore IS 'gnunet-datastore data'; | ||
27 | |||
28 | SET search_path TO datastore; | ||
29 | |||
30 | CREATE TABLE IF NOT EXISTS gn090 ( | ||
31 | repl INTEGER NOT NULL DEFAULT 0, | ||
32 | type INTEGER NOT NULL DEFAULT 0, | ||
33 | prio INTEGER NOT NULL DEFAULT 0, | ||
34 | anonLevel INTEGER NOT NULL DEFAULT 0, | ||
35 | expire BIGINT NOT NULL DEFAULT 0, | ||
36 | rvalue BIGINT NOT NULL DEFAULT 0, | ||
37 | hash BYTEA NOT NULL DEFAULT '', | ||
38 | vhash BYTEA NOT NULL DEFAULT '', | ||
39 | value BYTEA NOT NULL DEFAULT '', | ||
40 | oid BIGINT GENERATED BY DEFAULT AS IDENTITY); | ||
41 | |||
42 | CREATE INDEX IF NOT EXISTS oid_hash ON gn090 (oid); | ||
43 | CREATE INDEX IF NOT EXISTS idx_hash ON gn090 (hash); | ||
44 | CREATE INDEX IF NOT EXISTS idx_prio_anon ON gn090 (prio,anonLevel); | ||
45 | CREATE INDEX IF NOT EXISTS idx_prio_hash_anon ON gn090 (prio,hash,anonLevel); | ||
46 | CREATE INDEX IF NOT EXISTS idx_repl_rvalue ON gn090 (repl,rvalue); | ||
47 | CREATE INDEX IF NOT EXISTS idx_expire_hash ON gn090 (expire,hash); | ||
48 | |||
49 | COMMIT; | ||