Add integrations table in db

This commit is contained in:
Hongbo Wu 2022-08-01 19:34:19 +08:00
parent f6df97c85d
commit 1e1b573c52
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,23 @@
-- Type: DO
-- Name: integrations
-- Description: Create integrations table
BEGIN;
CREATE TABLE omnivore.integrations (
id uuid PRIMARY KEY DEFAULT uuid_generate_v1mc(),
user_id uuid NOT NULL REFERENCES omnivore.user ON DELETE CASCADE,
name varchar(50) NOT NULL,
token varchar(255) NOT NULL,
enabled boolean NOT NULL DEFAULT true,
description varchar(255),
url varchar(255),
created_at timestamptz NOT NULL DEFAULT current_timestamp,
updated_at timestamptz NOT NULL DEFAULT current_timestamp,
UNIQUE (user_id, name)
);
CREATE TRIGGER update_integration_modtime BEFORE UPDATE ON omnivore.integrations
FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column();
COMMIT;

View file

@ -0,0 +1,9 @@
-- Type: UNDO
-- Name: integrations
-- Description: Create integrations table
BEGIN;
DROP TABLE IF EXISTS omnivore.integrations;
COMMIT;