From 2237d02828c642bfd8225c4e39182f928fd1d7db Mon Sep 17 00:00:00 2001 From: Daniel Moran Date: Tue, 17 Aug 2021 15:21:16 -0400 Subject: [PATCH] feat: add SQL migration for remote connection metadata (#22237) --- .../migrations/0003_create_remotes_table.sql | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 sqlite/migrations/0003_create_remotes_table.sql diff --git a/sqlite/migrations/0003_create_remotes_table.sql b/sqlite/migrations/0003_create_remotes_table.sql new file mode 100644 index 00000000000..25b71ae1c3e --- /dev/null +++ b/sqlite/migrations/0003_create_remotes_table.sql @@ -0,0 +1,21 @@ +-- The user_version should match the "000X" from the file name +-- Ex: 0001_create_notebooks_table should have a user_verison of 1 +PRAGMA user_version=3; + +CREATE TABLE remotes ( + id VARCHAR(16) NOT NULL PRIMARY KEY, + org_id VARCHAR(16) NOT NULL, + name TEXT NOT NULL, + description TEXT, + remote_url TEXT NOT NULL, + remote_api_token TEXT NOT NULL, + remote_org_id VARCHAR(16) NOT NULL, + allow_insecure_tls BOOLEAN NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + + CONSTRAINT remotes_uniq_orgid_name UNIQUE (org_id, name) +); + +-- Create indexes on lookup patterns we expect to be common +CREATE INDEX idx_remote_url_per_org ON remotes (org_id, remote_url);