Debian Codegraph @

extensions/Echo/sql/postgres/tables-generated.sql

raw
1 -- This file is automatically generated using maintenance/generateSchemaSql.php.
2 -- Source: sql/tables.json
3 -- Do not modify this file directly.
4 -- See https://www.mediawiki.org/wiki/Manual:Schema_changes
5 CREATE TABLE echo_event (
6 event_id SERIAL NOT NULL,
7 event_type TEXT NOT NULL,
8 event_variant TEXT DEFAULT NULL,
9 event_agent_id INT DEFAULT NULL,
10 event_agent_ip TEXT DEFAULT NULL,
11 event_extra TEXT DEFAULT NULL,
12 event_page_id INT DEFAULT NULL,
13 event_deleted SMALLINT DEFAULT 0 NOT NULL,
14 PRIMARY KEY(event_id)
15 );
16
17 CREATE INDEX echo_event_type ON echo_event (event_type);
18
19 CREATE INDEX echo_event_page_id ON echo_event (event_page_id);
20
21
22 CREATE TABLE echo_notification (
23 notification_event INT NOT NULL,
24 notification_user INT NOT NULL,
25 notification_timestamp TIMESTAMPTZ NOT NULL,
26 notification_read_timestamp TIMESTAMPTZ DEFAULT NULL,
27 notification_bundle_hash TEXT NOT NULL,
28 PRIMARY KEY(
29 notification_user, notification_event
30 )
31 );
32
33 CREATE INDEX echo_user_timestamp ON echo_notification (
34 notification_user, notification_timestamp
35 );
36
37 CREATE INDEX echo_notification_event ON echo_notification (notification_event);
38
39 CREATE INDEX echo_notification_user_read_timestamp ON echo_notification (
40 notification_user, notification_read_timestamp
41 );
42
43
44 CREATE TABLE echo_email_batch (
45 eeb_id SERIAL NOT NULL,
46 eeb_user_id INT NOT NULL,
47 eeb_event_priority SMALLINT DEFAULT 10 NOT NULL,
48 eeb_event_id INT NOT NULL,
49 eeb_event_hash TEXT NOT NULL,
50 PRIMARY KEY(eeb_id)
51 );
52
53 CREATE UNIQUE INDEX echo_email_batch_user_event ON echo_email_batch (eeb_user_id, eeb_event_id);
54
55 CREATE INDEX echo_email_batch_user_hash_priority ON echo_email_batch (
56 eeb_user_id, eeb_event_hash, eeb_event_priority
57 );
58
59
60 CREATE TABLE echo_target_page (
61 etp_id SERIAL NOT NULL,
62 etp_page INT DEFAULT 0 NOT NULL,
63 etp_event INT DEFAULT 0 NOT NULL,
64 PRIMARY KEY(etp_id)
65 );
66
67 CREATE INDEX echo_target_page_event ON echo_target_page (etp_event);
68
69 CREATE INDEX echo_target_page_page_event ON echo_target_page (etp_page, etp_event);
70
71
72 CREATE TABLE echo_push_provider (
73 epp_id SMALLSERIAL NOT NULL,
74 epp_name TEXT NOT NULL,
75 PRIMARY KEY(epp_id)
76 );
77
78
79 CREATE TABLE echo_push_subscription (
80 eps_id SERIAL NOT NULL,
81 eps_user INT NOT NULL,
82 eps_token TEXT NOT NULL,
83 eps_token_sha256 CHAR(64) NOT NULL,
84 eps_provider SMALLINT NOT NULL,
85 eps_updated TIMESTAMPTZ NOT NULL,
86 eps_data TEXT DEFAULT NULL,
87 eps_topic SMALLINT DEFAULT NULL,
88 PRIMARY KEY(eps_id)
89 );
90
91 CREATE UNIQUE INDEX eps_token_sha256 ON echo_push_subscription (eps_token_sha256);
92
93 CREATE INDEX eps_provider ON echo_push_subscription (eps_provider);
94
95 CREATE INDEX eps_topic ON echo_push_subscription (eps_topic);
96
97 CREATE INDEX eps_user ON echo_push_subscription (eps_user);
98
99 CREATE INDEX eps_token ON echo_push_subscription (eps_token);
100
101
102 CREATE TABLE echo_push_topic (
103 ept_id SMALLSERIAL NOT NULL,
104 ept_text TEXT NOT NULL,
105 PRIMARY KEY(ept_id)
106 );