aboutsummaryrefslogtreecommitdiff
path: root/sql/mysql/mod_mam.sql
blob: 97aef86c1f5dd5fb78a6f762bbcfc62c0ffcae31 (plain) (blame)
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
CREATE TABLE archive (
    username varchar(191) NOT NULL,
    server_host text NOT NULL,
    timestamp BIGINT UNSIGNED NOT NULL,
    peer varchar(191) NOT NULL,
    bare_peer varchar(191) NOT NULL,
    xml text NOT NULL,
    txt text,
    id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
    kind varchar(10),
    nick varchar(191),
    created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

CREATE INDEX i_archive_sh_username_timestamp ON archive(server_host(191), username(191), timestamp);
CREATE INDEX i_archive_sh_username_peer ON archive(server_host(191), username(191), peer(191));
CREATE INDEX i_archive_sh_username_bare_peer ON archive(server_host(191), username(191), bare_peer(191));
CREATE INDEX i_archive_sh_timestamp ON archive(server_host(191), timestamp);

CREATE TABLE archive_prefs (
    username varchar(191) NOT NULL,
    server_host text NOT NULL,
    def text NOT NULL,
    always text NOT NULL,
    never text NOT NULL,
    created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (server_host(191), username)
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;