Rename movies colums
This commit is contained in:
parent
bdb608ae6e
commit
049c3b208c
@ -11,12 +11,26 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
addMovieQuery = `
|
addMovieQuery = `
|
||||||
INSERT INTO movies (imdbid, title, rating, votes, plot, tmdbid, year, originaltitle, runtime, sorttitle, tagline)
|
INSERT INTO movies (imdb_id, title, rating, votes, plot, tmdb_id, year, original_title, runtime, sort_title, tagline)
|
||||||
VALUES (:imdbid, :title, :rating, :votes, :plot, :tmdbid, :year, :originaltitle, :runtime, :sorttitle, :tagline)
|
VALUES (:imdbid, :title, :rating, :votes, :plot, :tmdbid, :year, :originaltitle, :runtime, :sorttitle, :tagline)
|
||||||
RETURNING id;`
|
RETURNING id;`
|
||||||
|
|
||||||
getMovieQueryByImdbID = `SELECT * FROM movies WHERE imdbid=$1;`
|
getMovieQueryByImdbID = `
|
||||||
getMovieQueryByID = `SELECT * FROM movies WHERE id=$1;`
|
SELECT
|
||||||
|
id, imdb_id AS imdbid, title, rating, votes, plot,
|
||||||
|
tmdb_id AS tmdbid, year,
|
||||||
|
original_title AS originaltitle, runtime,
|
||||||
|
sort_title AS sorttitle, tagline,
|
||||||
|
created_at, updated_at
|
||||||
|
FROM movies WHERE imdb_id=$1;`
|
||||||
|
getMovieQueryByID = `
|
||||||
|
SELECT
|
||||||
|
id, imdb_id AS imdbid, title, rating, votes, plot,
|
||||||
|
tmdb_id AS tmdbid, year,
|
||||||
|
original_title AS originaltitle, runtime,
|
||||||
|
sort_title AS sorttitle, tagline,
|
||||||
|
created_at, updated_at
|
||||||
|
FROM movies WHERE id=$1;`
|
||||||
deleteMovieQuery = `DELETE FROM movies WHERE id=$1;`
|
deleteMovieQuery = `DELETE FROM movies WHERE id=$1;`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -72,18 +72,18 @@ CREATE INDEX ON shows_tracked (user_id);
|
|||||||
|
|
||||||
CREATE TABLE movies (
|
CREATE TABLE movies (
|
||||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
imdbid text NOT NULL UNIQUE,
|
imdb_id text NOT NULL UNIQUE,
|
||||||
title text NOT NULL,
|
title text NOT NULL,
|
||||||
rating real NOT NULL,
|
rating real NOT NULL,
|
||||||
votes integer NOT NULL,
|
votes integer NOT NULL,
|
||||||
plot text NOT NULL,
|
plot text NOT NULL,
|
||||||
tmdbid integer NOT NULL,
|
tmdb_id integer NOT NULL,
|
||||||
year smallint NOT NULL,
|
year smallint NOT NULL,
|
||||||
originaltitle text NOT NULL,
|
original_title text NOT NULL,
|
||||||
runtime integer NOT NULL,
|
runtime integer NOT NULL,
|
||||||
sorttitle text NOT NULL,
|
sort_title text NOT NULL,
|
||||||
tagline text NOT NULL,
|
tagline text NOT NULL,
|
||||||
LIKE base INCLUDING DEFAULTS
|
LIKE base INCLUDING DEFAULTS
|
||||||
);
|
);
|
||||||
CREATE INDEX ON movies (imdbid);
|
CREATE INDEX ON movies (imdb_id);
|
||||||
CREATE TRIGGER update_movies_updated_at BEFORE UPDATE ON movies FOR EACH ROW EXECUTE PROCEDURE update_modified_column();
|
CREATE TRIGGER update_movies_updated_at BEFORE UPDATE ON movies FOR EACH ROW EXECUTE PROCEDURE update_modified_column();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user