Add server_name columns

This commit is contained in:
Neil Alexander 2022-11-04 11:09:43 +00:00
parent 98d3f88bfb
commit 7fd2c10975
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
16 changed files with 16 additions and 0 deletions

View file

@ -29,6 +29,7 @@ const accountDataSchema = `
CREATE TABLE IF NOT EXISTS userapi_account_datas ( CREATE TABLE IF NOT EXISTS userapi_account_datas (
-- The Matrix user ID localpart for this account -- The Matrix user ID localpart for this account
localpart TEXT NOT NULL, localpart TEXT NOT NULL,
server_name TEXT NOT NULL,
-- The room ID for this data (empty string if not specific to a room) -- The room ID for this data (empty string if not specific to a room)
room_id TEXT, room_id TEXT,
-- The account data type -- The account data type

View file

@ -35,6 +35,7 @@ const accountsSchema = `
CREATE TABLE IF NOT EXISTS userapi_accounts ( CREATE TABLE IF NOT EXISTS userapi_accounts (
-- The Matrix user ID localpart for this account -- The Matrix user ID localpart for this account
localpart TEXT NOT NULL PRIMARY KEY, localpart TEXT NOT NULL PRIMARY KEY,
server_name TEXT NOT NULL,
-- When this account was first created, as a unix timestamp (ms resolution). -- When this account was first created, as a unix timestamp (ms resolution).
created_ts BIGINT NOT NULL, created_ts BIGINT NOT NULL,
-- The password hash for this account. Can be NULL if this is a passwordless account. -- The password hash for this account. Can be NULL if this is a passwordless account.

View file

@ -50,6 +50,7 @@ CREATE TABLE IF NOT EXISTS userapi_devices (
-- as it is smaller, makes it clearer that we only manage devices for our own users, and may make -- as it is smaller, makes it clearer that we only manage devices for our own users, and may make
-- migration to different domain names easier. -- migration to different domain names easier.
localpart TEXT NOT NULL, localpart TEXT NOT NULL,
server_name TEXT NOT NULL,
-- When this devices was first recognised on the network, as a unix timestamp (ms resolution). -- When this devices was first recognised on the network, as a unix timestamp (ms resolution).
created_ts BIGINT NOT NULL, created_ts BIGINT NOT NULL,
-- The display name, human friendlier than device_id and updatable -- The display name, human friendlier than device_id and updatable

View file

@ -43,6 +43,7 @@ const notificationSchema = `
CREATE TABLE IF NOT EXISTS userapi_notifications ( CREATE TABLE IF NOT EXISTS userapi_notifications (
id BIGSERIAL PRIMARY KEY, id BIGSERIAL PRIMARY KEY,
localpart TEXT NOT NULL, localpart TEXT NOT NULL,
server_name TEXT NOT NULL,
room_id TEXT NOT NULL, room_id TEXT NOT NULL,
event_id TEXT NOT NULL, event_id TEXT NOT NULL,
stream_pos BIGINT NOT NULL, stream_pos BIGINT NOT NULL,

View file

@ -18,6 +18,7 @@ CREATE TABLE IF NOT EXISTS userapi_openid_tokens (
token TEXT NOT NULL PRIMARY KEY, token TEXT NOT NULL PRIMARY KEY,
-- The Matrix user ID for this account -- The Matrix user ID for this account
localpart TEXT NOT NULL, localpart TEXT NOT NULL,
server_name TEXT NOT NULL,
-- When the token expires, as a unix timestamp (ms resolution). -- When the token expires, as a unix timestamp (ms resolution).
token_expires_at_ms BIGINT NOT NULL token_expires_at_ms BIGINT NOT NULL
); );

View file

@ -30,6 +30,7 @@ const profilesSchema = `
CREATE TABLE IF NOT EXISTS userapi_profiles ( CREATE TABLE IF NOT EXISTS userapi_profiles (
-- The Matrix user ID localpart for this account -- The Matrix user ID localpart for this account
localpart TEXT NOT NULL PRIMARY KEY, localpart TEXT NOT NULL PRIMARY KEY,
server_name TEXT NOT NULL,
-- The display name for this account -- The display name for this account
display_name TEXT, display_name TEXT,
-- The URL of the avatar for this account -- The URL of the avatar for this account

View file

@ -33,6 +33,7 @@ CREATE TABLE IF NOT EXISTS userapi_pushers (
id BIGSERIAL PRIMARY KEY, id BIGSERIAL PRIMARY KEY,
-- The Matrix user ID localpart for this pusher -- The Matrix user ID localpart for this pusher
localpart TEXT NOT NULL, localpart TEXT NOT NULL,
server_name TEXT NOT NULL,
session_id BIGINT DEFAULT NULL, session_id BIGINT DEFAULT NULL,
profile_tag TEXT, profile_tag TEXT,
kind TEXT NOT NULL, kind TEXT NOT NULL,

View file

@ -33,6 +33,7 @@ CREATE TABLE IF NOT EXISTS userapi_threepids (
medium TEXT NOT NULL DEFAULT 'email', medium TEXT NOT NULL DEFAULT 'email',
-- The localpart of the Matrix user ID associated to this 3PID -- The localpart of the Matrix user ID associated to this 3PID
localpart TEXT NOT NULL, localpart TEXT NOT NULL,
server_name TEXT NOT NULL,
PRIMARY KEY(threepid, medium) PRIMARY KEY(threepid, medium)
); );

View file

@ -28,6 +28,7 @@ const accountDataSchema = `
CREATE TABLE IF NOT EXISTS userapi_account_datas ( CREATE TABLE IF NOT EXISTS userapi_account_datas (
-- The Matrix user ID localpart for this account -- The Matrix user ID localpart for this account
localpart TEXT NOT NULL, localpart TEXT NOT NULL,
server_name TEXT NOT NULL,
-- The room ID for this data (empty string if not specific to a room) -- The room ID for this data (empty string if not specific to a room)
room_id TEXT, room_id TEXT,
-- The account data type -- The account data type

View file

@ -35,6 +35,7 @@ const accountsSchema = `
CREATE TABLE IF NOT EXISTS userapi_accounts ( CREATE TABLE IF NOT EXISTS userapi_accounts (
-- The Matrix user ID localpart for this account -- The Matrix user ID localpart for this account
localpart TEXT NOT NULL PRIMARY KEY, localpart TEXT NOT NULL PRIMARY KEY,
server_name TEXT NOT NULL,
-- When this account was first created, as a unix timestamp (ms resolution). -- When this account was first created, as a unix timestamp (ms resolution).
created_ts BIGINT NOT NULL, created_ts BIGINT NOT NULL,
-- The password hash for this account. Can be NULL if this is a passwordless account. -- The password hash for this account. Can be NULL if this is a passwordless account.

View file

@ -40,6 +40,7 @@ CREATE TABLE IF NOT EXISTS userapi_devices (
session_id INTEGER, session_id INTEGER,
device_id TEXT , device_id TEXT ,
localpart TEXT , localpart TEXT ,
server_name TEXT NOT NULL,
created_ts BIGINT, created_ts BIGINT,
display_name TEXT, display_name TEXT,
last_seen_ts BIGINT, last_seen_ts BIGINT,

View file

@ -43,6 +43,7 @@ const notificationSchema = `
CREATE TABLE IF NOT EXISTS userapi_notifications ( CREATE TABLE IF NOT EXISTS userapi_notifications (
id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER PRIMARY KEY AUTOINCREMENT,
localpart TEXT NOT NULL, localpart TEXT NOT NULL,
server_name TEXT NOT NULL,
room_id TEXT NOT NULL, room_id TEXT NOT NULL,
event_id TEXT NOT NULL, event_id TEXT NOT NULL,
stream_pos BIGINT NOT NULL, stream_pos BIGINT NOT NULL,

View file

@ -18,6 +18,7 @@ CREATE TABLE IF NOT EXISTS userapi_openid_tokens (
token TEXT NOT NULL PRIMARY KEY, token TEXT NOT NULL PRIMARY KEY,
-- The Matrix user ID for this account -- The Matrix user ID for this account
localpart TEXT NOT NULL, localpart TEXT NOT NULL,
server_name TEXT NOT NULL,
-- When the token expires, as a unix timestamp (ms resolution). -- When the token expires, as a unix timestamp (ms resolution).
token_expires_at_ms BIGINT NOT NULL token_expires_at_ms BIGINT NOT NULL
); );

View file

@ -30,6 +30,7 @@ const profilesSchema = `
CREATE TABLE IF NOT EXISTS userapi_profiles ( CREATE TABLE IF NOT EXISTS userapi_profiles (
-- The Matrix user ID localpart for this account -- The Matrix user ID localpart for this account
localpart TEXT NOT NULL PRIMARY KEY, localpart TEXT NOT NULL PRIMARY KEY,
server_name TEXT NOT NULL,
-- The display name for this account -- The display name for this account
display_name TEXT, display_name TEXT,
-- The URL of the avatar for this account -- The URL of the avatar for this account

View file

@ -33,6 +33,7 @@ CREATE TABLE IF NOT EXISTS userapi_pushers (
id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER PRIMARY KEY AUTOINCREMENT,
-- The Matrix user ID localpart for this pusher -- The Matrix user ID localpart for this pusher
localpart TEXT NOT NULL, localpart TEXT NOT NULL,
server_name TEXT NOT NULL,
session_id BIGINT DEFAULT NULL, session_id BIGINT DEFAULT NULL,
profile_tag TEXT, profile_tag TEXT,
kind TEXT NOT NULL, kind TEXT NOT NULL,

View file

@ -34,6 +34,7 @@ CREATE TABLE IF NOT EXISTS userapi_threepids (
medium TEXT NOT NULL DEFAULT 'email', medium TEXT NOT NULL DEFAULT 'email',
-- The localpart of the Matrix user ID associated to this 3PID -- The localpart of the Matrix user ID associated to this 3PID
localpart TEXT NOT NULL, localpart TEXT NOT NULL,
server_name TEXT NOT NULL,
PRIMARY KEY(threepid, medium) PRIMARY KEY(threepid, medium)
); );