Eric Bower
·
15 Dec 22
20221112_add_feeds_space.sql
1ALTER TYPE space ADD VALUE 'feeds';
2
3-- CREATE TABLE IF NOT EXISTS feeds (
4-- id uuid NOT NULL DEFAULT uuid_generate_v4(),
5-- user_id uuid NOT NULL,
6-- post_id uuid NOT NULL,
7-- atom_id character varying(250),
8-- title character varying(250),
9-- subtitle character varying(250),
10-- author character varying(250),
11-- link character varying(2000),
12-- fetched_at timestamp without time zone,
13-- created_at timestamp without time zone NOT NULL DEFAULT NOW(),
14-- updated_at timestamp without time zone NOT NULL DEFAULT NOW(),
15-- CONSTRAINT entry_unique_id UNIQUE (post_id, atom_id),
16-- CONSTRAINT feed_pkey PRIMARY KEY (id),
17-- CONSTRAINT fk_user_posts
18-- FOREIGN KEY(user_id)
19-- REFERENCES app_users(id)
20-- ON DELETE CASCADE
21-- ON UPDATE CASCADE,
22-- CONSTRAINT fk_feed_posts
23-- FOREIGN KEY(post_id)
24-- REFERENCES posts(id)
25-- ON DELETE CASCADE
26-- ON UPDATE CASCADE
27-- );
28--
29-- CREATE TABLE IF NOT EXISTS feed_entry (
30-- id uuid NOT NULL DEFAULT uuid_generate_v4(),
31-- feed_id uuid NOT NULL,
32-- atom_id character varying(250),
33-- read boolean NOT NULL DEFAULT false,
34-- author character varying(250),
35-- category character varying(250),
36-- rights character varying(2000),
37-- source character varying(2000),
38-- content text,
39-- contributor character varying(250),
40-- link character varying(2000),
41-- summary text,
42-- title character varying(250),
43-- published timestamp without time zone NOT NULL DEFAULT NOW(),
44-- created_at timestamp without time zone NOT NULL DEFAULT NOW(),
45-- updated_at timestamp without time zone NOT NULL DEFAULT NOW(),
46-- CONSTRAINT entry_unique_atom_id UNIQUE (feed_id, atom_id),
47-- CONSTRAINT feed_entry_pkey PRIMARY KEY (id),
48-- CONSTRAINT fk_entry_feed
49-- FOREIGN KEY(feed_id)
50-- REFERENCES feeds(id)
51-- ON DELETE CASCADE
52-- ON UPDATE CASCADE
53-- );