mirror of
https://github.com/zoriya/vex.git
synced 2025-12-05 22:56:09 +00:00
Add db creation script
This commit is contained in:
5
.pg_format
Normal file
5
.pg_format
Normal file
@@ -0,0 +1,5 @@
|
||||
tabs=1
|
||||
function-case=1 #lowercase
|
||||
keyword-case=1
|
||||
type-case=1
|
||||
no-space-function=1
|
||||
@@ -21,6 +21,8 @@ services:
|
||||
- ./.env
|
||||
volumes:
|
||||
- db:/var/lib/postgresql/data
|
||||
- ./sql/create.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
command: ["postgres", "-c", "log_statement=all"]
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
||||
interval: 5s
|
||||
|
||||
36
sql/create.sql
Normal file
36
sql/create.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
create table if not exists users(
|
||||
id uuid not null primary key,
|
||||
name text not null,
|
||||
password varchar(100) not null,
|
||||
email text not null
|
||||
);
|
||||
|
||||
create table if not exists feeds(
|
||||
id uuid not null primary key,
|
||||
name text not null,
|
||||
link text not null,
|
||||
favicon_url text not null,
|
||||
tags text[] not null,
|
||||
submitter_id uuid not null references users(id)
|
||||
);
|
||||
|
||||
create table if not exists entries(
|
||||
id uuid not null primary key,
|
||||
feed_id uuid not null references feed(id),
|
||||
title text not null,
|
||||
link text not null,
|
||||
date timestamp with time zone not null,
|
||||
content text not null,
|
||||
author text
|
||||
);
|
||||
|
||||
create table if not exists entries_users(
|
||||
user_id uuid not null references users(id),
|
||||
feed_id uuid not null references feeds(id),
|
||||
is_read bool not null,
|
||||
is_bookmarked bool not null,
|
||||
is_read_later bool not null,
|
||||
is_ignored bool not null,
|
||||
constraint entries_users_pk primary keys(user_id, feed_id)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user