/usr/share/ratbox-services/lib/schema-pgsql.sql is in ratbox-services-pgsql 1.2.4-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | -- $Id: schema-pgsql.txt 23894 2007-05-01 17:24:07Z leeh $
CREATE TABLE users (
id SERIAL,
username VARCHAR(10) NOT NULL,
password VARCHAR(35) NOT NULL,
email VARCHAR(100),
suspender VARCHAR(30),
suspend_reason VARCHAR(200),
suspend_time INTEGER DEFAULT '0',
reg_time INTEGER,
last_time INTEGER,
flags INTEGER,
verify_token VARCHAR(8),
language VARCHAR(255) DEFAULT '',
PRIMARY KEY(id)
);
ALTER TABLE users ADD UNIQUE(username);
CREATE TABLE users_resetpass (
username VARCHAR(10) NOT NULL,
token VARCHAR(10),
time INTEGER,
PRIMARY KEY(username)
);
CREATE INDEX resetpass_time_idx ON users_resetpass (time);
CREATE TABLE users_resetemail (
username VARCHAR(10) NOT NULL,
token VARCHAR(10),
email VARCHAR(100) DEFAULT NULL,
time INTEGER,
PRIMARY KEY(username)
);
CREATE INDEX resetemail_time_idx ON users_resetemail (time);
CREATE TABLE users_sync (
id SERIAL,
hook VARCHAR(50) NOT NULL,
data TEXT,
PRIMARY KEY(id)
);
CREATE TABLE nicks (
nickname VARCHAR(9) NOT NULL,
username VARCHAR(10) NOT NULL,
reg_time INTEGER,
last_time INTEGER,
flags INTEGER,
PRIMARY KEY(nickname),
FOREIGN KEY(username) REFERENCES users (username) MATCH FULL
);
CREATE TABLE channels (
chname VARCHAR(200) NOT NULL,
topic VARCHAR(160),
url VARCHAR(100),
createmodes VARCHAR(50),
enforcemodes VARCHAR(50),
tsinfo INTEGER,
reg_time INTEGER,
last_time INTEGER,
flags INTEGER,
suspender VARCHAR(30),
suspend_reason VARCHAR(200),
suspend_time INTEGER DEFAULT '0',
PRIMARY KEY(chname)
);
CREATE TABLE channels_dropowner (
chname VARCHAR(200) NOT NULL,
token VARCHAR(10),
time INTEGER,
PRIMARY KEY(chname)
);
CREATE INDEX dropowner_time_idx ON channels_dropowner (time);
CREATE TABLE members (
chname VARCHAR(200) NOT NULL,
username VARCHAR(10) NOT NULL,
lastmod VARCHAR(10) NOT NULL,
level INT,
flags INTEGER,
suspend INT,
PRIMARY KEY(chname, username),
FOREIGN KEY(chname) REFERENCES channels (chname) MATCH FULL,
FOREIGN KEY(username) REFERENCES users (username) MATCH FULL
);
CREATE INDEX members_chname_idx ON members (chname);
CREATE INDEX members_username_idx ON members (username);
CREATE TABLE bans (
chname VARCHAR(200) NOT NULL,
mask VARCHAR(84) NOT NULL,
reason VARCHAR(50) NOT NULL,
username VARCHAR(10) NOT NULL,
level INT,
hold INT,
PRIMARY KEY(chname, mask),
FOREIGN KEY(chname) REFERENCES channels (chname) MATCH FULL
-- FOREIGN KEY(username) REFERENCES users (username) MATCH FULL
-- Username might not exist?
);
CREATE INDEX bans_chname_idx ON bans (chname);
CREATE TABLE operbot (
chname VARCHAR(200) NOT NULL,
tsinfo INTEGER,
oper VARCHAR(30),
PRIMARY KEY(chname)
);
CREATE TABLE operserv (
chname VARCHAR(200) NOT NULL,
tsinfo INTEGER,
oper VARCHAR(30),
PRIMARY KEY(chname)
);
CREATE TABLE jupes (
servername VARCHAR(63) NOT NULL,
reason VARCHAR(50) NOT NULL,
PRIMARY KEY(servername)
);
CREATE TABLE operbans (
type CHAR(1) NOT NULL,
mask VARCHAR(200) NOT NULL,
reason VARCHAR(50) NOT NULL,
operreason VARCHAR(50),
hold INTEGER,
create_time INTEGER,
oper VARCHAR(30),
remove BOOL,
flags INTEGER,
PRIMARY KEY(type, mask)
);
CREATE TABLE operbans_regexp (
id SERIAL,
regex VARCHAR(255) NOT NULL,
reason VARCHAR(50) NOT NULL,
hold INTEGER,
create_time INTEGER,
oper VARCHAR(30),
PRIMARY KEY(id)
);
CREATE TABLE operbans_regexp_neg (
id SERIAL,
parent_id BIGINT NOT NULL,
regex VARCHAR(255) NOT NULL,
oper VARCHAR(30) NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE global_welcome (
id INTEGER,
text TEXT,
PRIMARY KEY(id)
);
CREATE TABLE email_banned_domain (
domain VARCHAR(255) NOT NULL,
PRIMARY KEY(domain)
);
CREATE TABLE ignore_hosts (
hostname VARCHAR(255) NOT NULL,
oper VARCHAR(30) NOT NULL,
reason VARCHAR(255) NOT NULL,
PRIMARY KEY(hostname)
);
CREATE TABLE memos (
id SERIAL,
user_id BIGINT NOT NULL,
source_id BIGINT NOT NULL,
source VARCHAR(10) NOT NULL,
timestamp INTEGER DEFAULT '0',
flags INTEGER DEFAULT '0',
text TEXT,
PRIMARY KEY(id),
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE
);
|