31 lines
No EOL
720 B
SQL
31 lines
No EOL
720 B
SQL
-- Migration: InitBlog
|
|
-- Created at: 17/05/2025 19:57:35
|
|
|
|
|
|
CREATE SCHEMA blog;
|
|
|
|
CREATE TABLE blog.author
|
|
(
|
|
id uuid PRIMARY KEY,
|
|
username varchar(64) UNIQUE NOT NULL
|
|
);
|
|
|
|
CREATE TABLE blog.post
|
|
(
|
|
id uuid PRIMARY KEY,
|
|
content text NOT NULL,
|
|
posted_on timestamptz NOT NULL DEFAULT now(),
|
|
author_id uuid NOT NULL REFERENCES blog.author (id) on DELETE CASCADE,
|
|
is_private bool NOT NULL DEFAULT false
|
|
);
|
|
|
|
CREATE TABLE blog.post_media
|
|
(
|
|
id uuid PRIMARY KEY,
|
|
post_id uuid NOT NULL REFERENCES blog.post (id) ON DELETE CASCADE,
|
|
url text NOT NULL,
|
|
type varchar(64),
|
|
width int,
|
|
height int,
|
|
ordering int NOT NULL
|
|
); |