aboutsummaryrefslogtreecommitdiff
path: root/db/db.sql
blob: e3112561564fafd408771e93ac02b29e3eb8c0bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CREATE DATABASE IF NOT EXISTS clog;

\connect clog

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

CREATE TABLE IF NOT EXISTS entries (
	id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
	-- draft BOOLEAN NOT NULL DEFAULT TRUE,
	title CHARACTER VARYING NOT NULL,
	body CHARACTER VARYING NOT NULL,
	created_at TIMESTAMP NOT NULL DEFAULT NOW(),
	updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
	search_vector TSVECTOR DEFAULT NULL
);

CREATE INDEX entries_search_vector_idx ON entries USING GIN(search_vector);