mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
add create library_item sql
This commit is contained in:
parent
cf2a6b552a
commit
56698ae065
2 changed files with 76 additions and 0 deletions
59
packages/db/migrations/0118.do.library_item.sql
Executable file
59
packages/db/migrations/0118.do.library_item.sql
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
-- Type: DO
|
||||
-- Name: library_item
|
||||
-- Description: Create library_item table
|
||||
|
||||
BEGIN;
|
||||
|
||||
CREATE EXTENSION vector;
|
||||
|
||||
CREATE TYPE library_item_state AS ENUM ('SUCCEEDED', 'FAILED', 'PROCESSING', 'ARCHIVED', 'DELETED');
|
||||
|
||||
CREATE TYPE content_reader_type AS ENUM ('WEB', 'PDF', 'EPUB');
|
||||
|
||||
CREATE TABLE omnivore.library_item (
|
||||
id uuid PRIMARY KEY DEFAULT uuid_generate_v1mc(),
|
||||
user_id uuid NOT NULL REFERENCES omnivore.user ON DELETE CASCADE,
|
||||
state library_item_state NOT NULL DEFAULT 'SUCCEEDED',
|
||||
original_url text NOT NULL,
|
||||
download_url text,
|
||||
slug text NOT NULL,
|
||||
title text NOT NULL,
|
||||
author text,
|
||||
description text,
|
||||
saved_at timestamptz NOT NULL DEFAULT current_timestamp,
|
||||
created_at timestamptz NOT NULL DEFAULT current_timestamp,
|
||||
published_at timestamptz,
|
||||
archived_at timestamptz,
|
||||
deleted_at timestamptz,
|
||||
read_at timestamptz,
|
||||
updated_at timestamptz NOT NULL DEFAULT current_timestamp,
|
||||
language text,
|
||||
words_count integer,
|
||||
site_name text,
|
||||
site_icon text,
|
||||
metadata JSON,
|
||||
reading_progress_last_read_anchor integer,
|
||||
reading_progress_highest_read_anchor integer,
|
||||
reading_progress_top_percent real,
|
||||
reading_progress_bottom_percent real,
|
||||
thumbnail text,
|
||||
page_type text,
|
||||
upload_file_id uuid REFERENCES omnivore.upload_files ON DELETE CASCADE,
|
||||
content_reader content_reader_type,
|
||||
original_content text,
|
||||
readable_content text,
|
||||
content_tsv tsvector,
|
||||
site_tsv tsvector,
|
||||
title_tsv tsvector,
|
||||
author_tsv tsvector,
|
||||
description_tsv tsvector,
|
||||
search_tsv tsvector,
|
||||
model_name text,
|
||||
embedding vector(768),
|
||||
text_content_hash text,
|
||||
gcs_archive_id text
|
||||
);
|
||||
|
||||
CREATE TRIGGER update_library_item_modtime BEFORE UPDATE ON omnivore.library_item FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column();
|
||||
|
||||
COMMIT;
|
||||
17
packages/db/migrations/0118.undo.library_item.sql
Executable file
17
packages/db/migrations/0118.undo.library_item.sql
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
-- Type: UNDO
|
||||
-- Name: library_item
|
||||
-- Description: Create library_item table
|
||||
|
||||
BEGIN;
|
||||
|
||||
DROP TRIGGER update_library_item_modtime ON omnivore.library_item;
|
||||
|
||||
DROP TABLE omnivore.library_item;
|
||||
|
||||
DROP TYPE content_reader_type;
|
||||
|
||||
DROP TYPE library_item_state;
|
||||
|
||||
DROP EXTENSION vector;
|
||||
|
||||
COMMIT;
|
||||
Loading…
Reference in a new issue