feat: ✨ almost done
frontend missing yet
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
create table if not exists tv_show (
|
||||
id integer primary key,
|
||||
id serial unique primary key,
|
||||
"name" varchar not null,
|
||||
tt_imdb varchar not null,
|
||||
popularity int not null default 0,
|
||||
@@ -13,7 +13,7 @@ create index if not exists idx_tv_show_tt_imdb on "tv_show" ("tt_imdb");
|
||||
create index if not exists idx_tv_show_updated_at on "tv_show" ("updated_at");
|
||||
|
||||
create table if not exists episodes (
|
||||
id integer primary key,
|
||||
id serial unique primary key,
|
||||
tv_show_id integer not null,
|
||||
|
||||
season integer not null,
|
||||
@@ -21,7 +21,7 @@ create table if not exists episodes (
|
||||
released date,
|
||||
"name" varchar not null,
|
||||
plot text not null default '',
|
||||
avg_rating numeric(1,1) not null default 0,
|
||||
avg_rating real not null default 0,
|
||||
vote_count int not null default 0,
|
||||
|
||||
foreign key (tv_show_id) references tv_show (id)
|
||||
|
||||
@@ -18,7 +18,7 @@ where tv_show_id = $1;
|
||||
|
||||
-- name: IncreasePopularity :exec
|
||||
update "tv_show" set popularity = popularity + 1
|
||||
where id = $1;
|
||||
where tt_imdb = $1;
|
||||
|
||||
-- name: TvShowAverageRating :one
|
||||
select avg(avg_rating) from "episodes"
|
||||
|
||||
Reference in New Issue
Block a user