Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/database/setup-db.js
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | SQL` | ||||
user bigint(20) NOT NULL, | user bigint(20) NOT NULL, | ||||
type tinyint(3) UNSIGNED NOT NULL, | type tinyint(3) UNSIGNED NOT NULL, | ||||
content mediumtext COLLATE utf8mb4_bin, | content mediumtext COLLATE utf8mb4_bin, | ||||
time bigint(20) NOT NULL, | time bigint(20) NOT NULL, | ||||
creation varchar(255) COLLATE utf8mb4_bin DEFAULT NULL, | creation varchar(255) COLLATE utf8mb4_bin DEFAULT NULL, | ||||
target_message bigint(20) DEFAULT NULL | target_message bigint(20) DEFAULT NULL | ||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; | ||||
CREATE TABLE pinned_messages ( | |||||
messageID bigint(20) NOT NULL, | |||||
thread bigint(20) NOT NULL, | |||||
tomek: These are both ids: why do we use `ID` suffix for just one of them? | |||||
rohanAuthorUnsubmitted Done Inline ActionsI tried following convention, and we use thread to represent the thread in each table. I didn't really have a better name for the message id, maybe just message or id. rohan: I tried following convention, and we use `thread` to represent the thread in each table. I… | |||||
pin_time bigint(20) NOT NULL | |||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||||
CREATE TABLE notifications ( | CREATE TABLE notifications ( | ||||
id bigint(20) NOT NULL, | id bigint(20) NOT NULL, | ||||
user bigint(20) NOT NULL, | user bigint(20) NOT NULL, | ||||
thread bigint(20) DEFAULT NULL, | thread bigint(20) DEFAULT NULL, | ||||
message bigint(20) DEFAULT NULL, | message bigint(20) DEFAULT NULL, | ||||
collapse_key varchar(255) DEFAULT NULL, | collapse_key varchar(255) DEFAULT NULL, | ||||
delivery json NOT NULL, | delivery json NOT NULL, | ||||
rescinded tinyint(1) NOT NULL | rescinded tinyint(1) NOT NULL | ||||
▲ Show 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | SQL` | ||||
ALTER TABLE metadata | ALTER TABLE metadata | ||||
ADD PRIMARY KEY (name); | ADD PRIMARY KEY (name); | ||||
ALTER TABLE policy_acknowledgments | ALTER TABLE policy_acknowledgments | ||||
ADD PRIMARY KEY (user, policy); | ADD PRIMARY KEY (user, policy); | ||||
ALTER TABLE siwe_nonces | ALTER TABLE siwe_nonces | ||||
ADD PRIMARY KEY (nonce); | ADD PRIMARY KEY (nonce); | ||||
ALTER TABLE pinned_messages | |||||
ADD PRIMARY KEY (messageID), | |||||
ADD INDEX thread (thread); | |||||
`, | `, | ||||
{ multipleStatements: true }, | { multipleStatements: true }, | ||||
); | ); | ||||
} | } | ||||
async function createUsers() { | async function createUsers() { | ||||
const [user1, user2] = sortIDs(bots.commbot.userID, ashoat.id); | const [user1, user2] = sortIDs(bots.commbot.userID, ashoat.id); | ||||
await dbQuery( | await dbQuery( | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |
These are both ids: why do we use ID suffix for just one of them?