waveterm/db/schema.sql

195 lines
5.9 KiB
MySQL
Raw Normal View History

2022-07-01 19:50:09 +02:00
CREATE TABLE schema_migrations (version uint64,dirty bool);
CREATE UNIQUE INDEX version_unique ON schema_migrations (version);
CREATE TABLE client (
2022-09-22 07:02:38 +02:00
clientid varchar(36) NOT NULL,
userid varchar(36) NOT NULL,
activesessionid varchar(36) NOT NULL,
userpublickeybytes blob NOT NULL,
userprivatekeybytes blob NOT NULL,
winsize json NOT NULL
2023-02-27 07:22:20 +01:00
, clientopts json NOT NULL DEFAULT '', feopts json NOT NULL DEFAULT '{}');
2022-07-01 19:50:09 +02:00
CREATE TABLE session (
sessionid varchar(36) PRIMARY KEY,
2022-08-08 17:34:59 +02:00
name varchar(50) NOT NULL,
sessionidx int NOT NULL,
activescreenid varchar(36) NOT NULL,
notifynum int NOT NULL,
2022-12-25 22:03:11 +01:00
archived boolean NOT NULL,
2022-12-25 22:21:48 +01:00
archivedts bigint NOT NULL,
2023-03-15 00:37:22 +01:00
sharemode varchar(12) NOT NULL);
2022-08-08 17:34:59 +02:00
CREATE TABLE remote_instance (
riid varchar(36) PRIMARY KEY,
name varchar(50) NOT NULL,
2022-07-01 19:50:09 +02:00
sessionid varchar(36) NOT NULL,
2023-03-15 00:37:22 +01:00
screenid varchar(36) NOT NULL,
2022-08-24 22:21:54 +02:00
remoteownerid varchar(36) NOT NULL,
2022-07-01 19:50:09 +02:00
remoteid varchar(36) NOT NULL,
2022-11-28 09:13:00 +01:00
festate json NOT NULL,
statebasehash varchar(36) NOT NULL,
statediffhasharr json NOT NULL
);
CREATE TABLE state_base (
basehash varchar(36) PRIMARY KEY,
ts bigint NOT NULL,
version varchar(200) NOT NULL,
data blob NOT NULL
);
CREATE TABLE state_diff (
diffhash varchar(36) PRIMARY KEY,
ts bigint NOT NULL,
basehash varchar(36) NOT NULL,
diffhasharr json NOT NULL,
data blob NOT NULL
2022-07-01 19:50:09 +02:00
);
CREATE TABLE line (
sessionid varchar(36) NOT NULL,
2023-03-15 00:37:22 +01:00
screenid varchar(36) NOT NULL,
2022-07-01 19:50:09 +02:00
userid varchar(36) NOT NULL,
lineid varchar(36) NOT NULL,
2022-07-01 19:50:09 +02:00
ts bigint NOT NULL,
linenum int NOT NULL,
linenumtemp boolean NOT NULL,
2022-07-01 19:50:09 +02:00
linetype varchar(10) NOT NULL,
linelocal boolean NOT NULL,
2022-07-01 19:50:09 +02:00
text text NOT NULL,
cmdid varchar(36) NOT NULL,
2022-08-24 06:05:49 +02:00
ephemeral boolean NOT NULL,
2022-11-28 09:13:00 +01:00
contentheight int NOT NULL,
star int NOT NULL,
2023-02-21 06:39:29 +01:00
archived boolean NOT NULL, renderer varchar(50) NOT NULL DEFAULT '', bookmarked boolean NOT NULL DEFAULT 0, pinned boolean NOT NULL DEFAULT 0,
2023-03-15 00:37:22 +01:00
PRIMARY KEY (sessionid, screenid, lineid)
2022-07-01 19:50:09 +02:00
);
CREATE TABLE remote (
remoteid varchar(36) PRIMARY KEY,
physicalid varchar(36) NOT NULL,
2022-07-01 19:50:09 +02:00
remotetype varchar(10) NOT NULL,
remotealias varchar(50) NOT NULL,
remotecanonicalname varchar(200) NOT NULL,
remotesudo boolean NOT NULL,
remoteuser varchar(50) NOT NULL,
remotehost varchar(200) NOT NULL,
connectmode varchar(20) NOT NULL,
autoinstall boolean NOT NULL,
2022-08-08 17:34:59 +02:00
sshopts json NOT NULL,
remoteopts json NOT NULL,
2022-09-14 02:11:36 +02:00
lastconnectts bigint NOT NULL,
local boolean NOT NULL,
2022-09-14 21:06:55 +02:00
archived boolean NOT NULL,
remoteidx int NOT NULL
2022-07-01 19:50:09 +02:00
);
2022-08-08 17:34:59 +02:00
CREATE TABLE cmd (
2022-07-01 19:50:09 +02:00
sessionid varchar(36) NOT NULL,
cmdid varchar(36) NOT NULL,
2022-08-24 22:21:54 +02:00
remoteownerid varchar(36) NOT NULL,
2022-07-01 19:50:09 +02:00
remoteid varchar(36) NOT NULL,
2022-08-24 22:21:54 +02:00
remotename varchar(50) NOT NULL,
2022-08-08 17:34:59 +02:00
cmdstr text NOT NULL,
festate json NOT NULL,
statebasehash varchar(36) NOT NULL,
statediffhasharr json NOT NULL,
2022-08-08 17:34:59 +02:00
termopts json NOT NULL,
2022-09-22 07:02:38 +02:00
origtermopts json NOT NULL,
2022-07-01 19:50:09 +02:00
status varchar(10) NOT NULL,
2022-08-08 17:34:59 +02:00
startpk json NOT NULL,
doneinfo json NOT NULL,
2022-08-08 17:34:59 +02:00
runout json NOT NULL,
rtnstate boolean NOT NULL,
rtnbasehash varchar(36) NOT NULL,
rtndiffhasharr json NOT NULL,
2022-07-01 19:50:09 +02:00
PRIMARY KEY (sessionid, cmdid)
);
CREATE TABLE history (
2022-08-11 21:07:41 +02:00
historyid varchar(36) PRIMARY KEY,
ts bigint NOT NULL,
userid varchar(36) NOT NULL,
2022-07-01 19:50:09 +02:00
sessionid varchar(36) NOT NULL,
2022-08-11 21:07:41 +02:00
screenid varchar(36) NOT NULL,
lineid int NOT NULL,
remoteownerid varchar(36) NOT NULL,
remoteid varchar(36) NOT NULL,
remotename varchar(50) NOT NULL,
2022-08-12 08:45:15 +02:00
haderror boolean NOT NULL,
2022-08-11 21:07:41 +02:00
cmdid varchar(36) NOT NULL,
cmdstr text NOT NULL,
ismetacmd boolean,
incognito boolean
2022-07-01 19:50:09 +02:00
);
2023-02-21 00:42:27 +01:00
CREATE TABLE bookmark (
bookmarkid varchar(36) PRIMARY KEY,
createdts bigint NOT NULL,
cmdstr text NOT NULL,
alias varchar(50) NOT NULL,
tags json NOT NULL,
description text NOT NULL
);
CREATE TABLE bookmark_order (
tag varchar(50) NOT NULL,
bookmarkid varchar(36) NOT NULL,
orderidx int NOT NULL,
PRIMARY KEY (tag, bookmarkid)
);
CREATE TABLE bookmark_cmd (
bookmarkid varchar(36) NOT NULL,
2023-02-21 06:39:29 +01:00
sessionid varchar(36) NOT NULL,
2023-02-21 00:42:27 +01:00
cmdid varchar(36) NOT NULL,
2023-02-21 06:39:29 +01:00
PRIMARY KEY (bookmarkid, sessionid, cmdid)
2023-02-21 00:42:27 +01:00
);
2023-03-15 00:37:22 +01:00
CREATE TABLE activity (
day varchar(20) PRIMARY KEY,
uploaded boolean NOT NULL,
tdata json NOT NULL,
tzname varchar(50) NOT NULL,
tzoffset int NOT NULL,
clientversion varchar(50) NOT NULL,
clientarch varchar(50) NOT NULL
, buildtime varchar(20) NOT NULL DEFAULT '-', osrelease varchar(20) NOT NULL DEFAULT '-');
CREATE TABLE playbook (
playbookid varchar(36) PRIMARY KEY,
playbookname varchar(100) NOT NULL,
description text NOT NULL,
entryids json NOT NULL
);
CREATE TABLE playbook_entry (
entryid varchar(36) PRIMARY KEY,
playbookid varchar(36) NOT NULL,
description text NOT NULL,
alias varchar(50) NOT NULL,
cmdstr text NOT NULL,
createdts bigint NOT NULL,
updatedts bigint NOT NULL
);
CREATE TABLE cloud_session (
sessionid varchar(36) PRIMARY KEY,
viewkey varchar(50) NOT NULL,
writekey varchar(50) NOT NULL,
enckey varchar(100) NOT NULL,
enctype varchar(50) NOT NULL,
vts bigint NOT NULL,
acl json NOT NULL
);
CREATE TABLE cloud_update (
updateid varchar(36) PRIMARY KEY,
ts bigint NOT NULL,
updatetype varchar(50) NOT NULL,
updatekeys json NOT NULL
);
CREATE TABLE IF NOT EXISTS "screen" (
sessionid varchar(36) NOT NULL,
screenid varchar(36) NOT NULL,
name varchar(50) NOT NULL,
screenidx int NOT NULL,
screenopts json NOT NULL,
ownerid varchar(36) NOT NULL,
sharemode varchar(12) NOT NULL,
curremoteownerid varchar(36) NOT NULL,
curremoteid varchar(36) NOT NULL,
curremotename varchar(50) NOT NULL,
nextlinenum int NOT NULL,
selectedline int NOT NULL,
anchor json NOT NULL,
focustype varchar(12) NOT NULL,
archived boolean NOT NULL,
archivedts bigint NOT NULL,
PRIMARY KEY (sessionid, screenid)
);