26 lines
1.0 KiB
SQL
26 lines
1.0 KiB
SQL
CREATE TABLE gateway (
|
|
name text PRIMARY KEY CHECK (name <> '' AND length(name) <= 64),
|
|
endpoint text NOT NULL,
|
|
token text NOT NULL UNIQUE,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
updated_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE TABLE browser_image (
|
|
version text PRIMARY KEY CHECK (version ~ '^[0-9][A-Za-z0-9.+~-]{0,63}$'),
|
|
image_ref text NOT NULL CHECK (image_ref ~ '^[A-Za-z0-9][A-Za-z0-9._:/@-]{0,300}$'),
|
|
note text NOT NULL DEFAULT '' CHECK (length(note) <= 200),
|
|
enabled boolean NOT NULL DEFAULT true,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
updated_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE TABLE browser_env (
|
|
alias text PRIMARY KEY CHECK (alias ~ '^[a-z0-9][a-z0-9-]{0,31}$'),
|
|
name text NOT NULL CHECK (name <> '' AND length(name) <= 64),
|
|
gateway_name text NOT NULL REFERENCES gateway(name),
|
|
image_version text NOT NULL REFERENCES browser_image(version),
|
|
fingerprint jsonb NOT NULL,
|
|
created_at timestamptz NOT NULL DEFAULT now()
|
|
);
|