Eric Bower
·
03 Aug 22
20220721_analytics.sql
1CREATE TABLE IF NOT EXISTS post_analytics (
2 id uuid NOT NULL DEFAULT uuid_generate_v4(),
3 post_id uuid NOT NULL,
4 views int DEFAULT 0,
5 updated_at timestamp without time zone NOT NULL DEFAULT NOW(),
6 CONSTRAINT analytics_pkey PRIMARY KEY (id),
7 CONSTRAINT fk_analytics_posts
8 FOREIGN KEY(post_id)
9 REFERENCES posts(id)
10 ON DELETE CASCADE
11 ON UPDATE CASCADE
12);