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);
|
2022-08-17 21:24:09 +02:00
|
|
|
CREATE TABLE client (
|
2022-09-22 07:02:38 +02:00
|
|
|
clientid varchar(36) NOT NULL,
|
2022-08-17 21:24:09 +02:00
|
|
|
userid varchar(36) NOT NULL,
|
2022-08-27 01:21:19 +02:00
|
|
|
activesessionid varchar(36) NOT NULL,
|
2022-08-17 21:24:09 +02:00
|
|
|
userpublickeybytes blob NOT NULL,
|
2022-10-04 20:45:24 +02:00
|
|
|
userprivatekeybytes blob NOT NULL,
|
|
|
|
winsize json NOT NULL
|
2023-07-26 19:10:27 +02:00
|
|
|
, clientopts json NOT NULL DEFAULT '', feopts json NOT NULL DEFAULT '{}', cmdstoretype varchar(20) DEFAULT 'session', openaiopts 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,
|
2022-08-17 21:24:09 +02:00
|
|
|
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 remote (
|
|
|
|
remoteid varchar(36) PRIMARY KEY,
|
|
|
|
remotetype varchar(10) NOT NULL,
|
2022-08-17 21:24:09 +02:00
|
|
|
remotealias varchar(50) NOT NULL,
|
|
|
|
remotecanonicalname varchar(200) NOT NULL,
|
|
|
|
remoteuser varchar(50) NOT NULL,
|
|
|
|
remotehost varchar(200) NOT NULL,
|
2022-08-21 21:31:29 +02:00
|
|
|
connectmode varchar(20) NOT NULL,
|
2022-10-04 20:45:24 +02:00
|
|
|
autoinstall boolean NOT NULL,
|
2022-08-08 17:34:59 +02:00
|
|
|
sshopts json NOT NULL,
|
2022-08-21 21:31:29 +02:00
|
|
|
remoteopts json NOT NULL,
|
2022-09-14 02:11:36 +02:00
|
|
|
lastconnectts bigint NOT NULL,
|
2022-10-04 20:45:24 +02:00
|
|
|
local boolean NOT NULL,
|
2022-09-14 21:06:55 +02:00
|
|
|
archived boolean NOT NULL,
|
|
|
|
remoteidx int NOT NULL
|
2023-07-26 19:10:27 +02:00
|
|
|
, statevars json NOT NULL DEFAULT '{}', openaiopts json NOT NULL DEFAULT '{}');
|
2022-07-01 19:50:09 +02:00
|
|
|
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,
|
2022-08-28 23:24:05 +02:00
|
|
|
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-28 23:24:05 +02:00
|
|
|
cmdstr text NOT NULL,
|
2022-12-20 03:52:08 +01:00
|
|
|
ismetacmd boolean,
|
|
|
|
incognito boolean
|
2023-03-20 20:19:48 +01:00
|
|
|
, linenum int NOT NULL DEFAULT 0);
|
|
|
|
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(20) NOT NULL,
|
|
|
|
clientarch varchar(20) NOT NULL
|
|
|
|
, buildtime varchar(20) NOT NULL DEFAULT '-', osrelease varchar(20) NOT NULL DEFAULT '-');
|
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)
|
|
|
|
);
|
2023-03-15 00:37:22 +01:00
|
|
|
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
|
|
|
|
);
|
2023-03-21 05:38:39 +01:00
|
|
|
CREATE TABLE cmd_migrate (
|
2023-03-15 00:37:22 +01:00
|
|
|
sessionid varchar(36) NOT NULL,
|
|
|
|
screenid varchar(36) NOT NULL,
|
2023-03-21 05:38:39 +01:00
|
|
|
cmdid varchar(36) NOT NULL
|
|
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS "screen" (
|
|
|
|
screenid varchar(36) NOT NULL,
|
|
|
|
sessionid varchar(36) NOT NULL,
|
2023-03-15 00:37:22 +01:00
|
|
|
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,
|
2023-03-24 18:34:07 +01:00
|
|
|
archivedts bigint NOT NULL, webshareopts json NOT NULL DEFAULT 'null',
|
2023-03-21 05:38:39 +01:00
|
|
|
PRIMARY KEY (screenid)
|
|
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS "line" (
|
|
|
|
screenid varchar(36) NOT NULL,
|
|
|
|
userid varchar(36) NOT NULL,
|
|
|
|
lineid varchar(36) NOT NULL,
|
|
|
|
ts bigint NOT NULL,
|
|
|
|
linenum int NOT NULL,
|
|
|
|
linenumtemp boolean NOT NULL,
|
|
|
|
linetype varchar(10) NOT NULL,
|
|
|
|
linelocal boolean NOT NULL,
|
|
|
|
text text NOT NULL,
|
|
|
|
ephemeral boolean NOT NULL,
|
|
|
|
contentheight int NOT NULL,
|
|
|
|
star int NOT NULL,
|
|
|
|
archived boolean NOT NULL,
|
2023-09-02 00:21:35 +02:00
|
|
|
renderer varchar(50) NOT NULL, linestate json NOT NULL DEFAULT '{}',
|
2023-03-21 05:38:39 +01:00
|
|
|
PRIMARY KEY (screenid, lineid)
|
|
|
|
);
|
2023-09-02 00:21:35 +02:00
|
|
|
CREATE TABLE screenupdate (
|
|
|
|
updateid integer PRIMARY KEY,
|
2023-03-21 05:38:39 +01:00
|
|
|
screenid varchar(36) NOT NULL,
|
2023-09-02 00:21:35 +02:00
|
|
|
lineid varchar(36) NOT NULL,
|
|
|
|
updatetype varchar(50) NOT NULL,
|
|
|
|
updatets bigint NOT NULL
|
|
|
|
);
|
|
|
|
CREATE TABLE webptypos (
|
|
|
|
screenid varchar(36) NOT NULL,
|
|
|
|
lineid varchar(36) NOT NULL,
|
|
|
|
ptypos bigint NOT NULL,
|
|
|
|
PRIMARY KEY (screenid, lineid)
|
|
|
|
);
|
|
|
|
CREATE INDEX idx_screenupdate_ids ON screenupdate (screenid, lineid);
|
|
|
|
CREATE TABLE cmd_migration (
|
|
|
|
screenid varchar(36) NOT NULL,
|
|
|
|
lineid varchar(36) NOT NULL,
|
2023-03-21 05:38:39 +01:00
|
|
|
cmdid varchar(36) NOT NULL,
|
2023-09-02 00:21:35 +02:00
|
|
|
PRIMARY KEY (screenid, lineid)
|
|
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS "cmd" (
|
|
|
|
screenid varchar(36) NOT NULL,
|
|
|
|
lineid varchar(36) NOT NULL,
|
2023-03-21 05:38:39 +01:00
|
|
|
remoteownerid varchar(36) NOT NULL,
|
|
|
|
remoteid varchar(36) NOT NULL,
|
|
|
|
remotename varchar(50) NOT NULL,
|
|
|
|
cmdstr text NOT NULL,
|
|
|
|
rawcmdstr text NOT NULL,
|
|
|
|
festate json NOT NULL,
|
|
|
|
statebasehash varchar(36) NOT NULL,
|
|
|
|
statediffhasharr json NOT NULL,
|
|
|
|
termopts json NOT NULL,
|
|
|
|
origtermopts json NOT NULL,
|
|
|
|
status varchar(10) NOT NULL,
|
2023-09-02 00:21:35 +02:00
|
|
|
cmdpid int NOT NULL,
|
|
|
|
remotepid int NOT NULL,
|
|
|
|
donets bigint NOT NULL,
|
|
|
|
exitcode int NOT NULL,
|
|
|
|
durationms int NOT NULL,
|
2023-03-21 05:38:39 +01:00
|
|
|
rtnstate boolean NOT NULL,
|
|
|
|
rtnbasehash varchar(36) NOT NULL,
|
|
|
|
rtndiffhasharr json NOT NULL,
|
2023-09-02 00:21:35 +02:00
|
|
|
runout json NOT NULL,
|
|
|
|
PRIMARY KEY (screenid, lineid)
|
2023-03-24 18:34:07 +01:00
|
|
|
);
|
2023-09-02 00:21:35 +02:00
|
|
|
CREATE TABLE cmd_migrate20 (
|
2023-03-29 21:40:53 +02:00
|
|
|
screenid varchar(36) NOT NULL,
|
|
|
|
lineid varchar(36) NOT NULL,
|
2023-09-02 00:21:35 +02:00
|
|
|
cmdid varchar(36) NOT NULL,
|
2023-03-29 21:40:53 +02:00
|
|
|
PRIMARY KEY (screenid, lineid)
|
|
|
|
);
|