From 67b54449a1bbde257e9454419e7bb70ebc515c0f Mon Sep 17 00:00:00 2001
From: cel 🌸 <cel@blos.sm>
Date: Thu, 14 Nov 2024 21:43:54 +0000
Subject: implement artwork upload

---
 migrations/20241113160730_critch.sql | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

(limited to 'migrations')

diff --git a/migrations/20241113160730_critch.sql b/migrations/20241113160730_critch.sql
index 131daf3..013fd07 100644
--- a/migrations/20241113160730_critch.sql
+++ b/migrations/20241113160730_critch.sql
@@ -1,7 +1,7 @@
 create extension if not exists "uuid-ossp";
 
 create table artists (
-    id integer primary key generated always as identity,
+    artist_id integer primary key generated always as identity,
     handle varchar(128) not null unique,
     name varchar(128),
     bio text,
@@ -9,39 +9,39 @@ create table artists (
 );
 
 create table artworks (
-    id integer primary key generated always as identity,
+    artwork_id integer primary key generated always as identity,
     title varchar(256),
     description text,
     url_source varchar(256),
     created_at timestamp not null default current_timestamp,
     artist_id integer not null,
     comment_number integer not null default 0,
-    foreign key (artist_id) references artists(id)
+    foreign key (artist_id) references artists(artist_id)
 );
 
 create table comments (
-    id integer unique not null,
+    comment_id integer unique not null,
     text text not null,
     artwork_id integer not null,
     created_at timestamp not null default current_timestamp,
-    primary key (id, artwork_id),
-    foreign key (artwork_id) references artworks(id)
+    primary key (comment_id, artwork_id),
+    foreign key (artwork_id) references artworks(artwork_id)
 );
 
 create table comment_relations (
     artwork_id integer,
-    foreign key (artwork_id) references artworks(id),
+    foreign key (artwork_id) references artworks(artwork_id),
     in_reply_to_id integer,
-    foreign key (in_reply_to_id) references comments(id),
+    foreign key (in_reply_to_id) references comments(comment_id),
     comment_id integer,
-    foreign key (comment_id) references comments(id),
+    foreign key (comment_id) references comments(comment_id),
     primary key (artwork_id, in_reply_to_id, comment_id)
 );
 
 create table artwork_files (
-    id uuid primary key default gen_random_uuid(),
+    file_id uuid primary key default gen_random_uuid(),
     alt_text text,
     extension varchar(16),
     artwork_id integer,
-    foreign key (artwork_id) references artworks(id)
+    foreign key (artwork_id) references artworks(artwork_id)
 );
-- 
cgit