- install requirement:
pipenv install
- Update database information in
seting.py
- Run
main.py
once then shut it down. - Run the following queries in the database to setup the differents INDEX and autogenerated fields:
-- add fts_col and gist index
ALTER TABLE song ADD COLUMN fts_col Text
GENERATED ALWAYS AS (coalesce(name, '') ||' '|| coalesce(artist, '') ||' '|| coalesce(album, '')) STORED;
COMMENT ON COLUMN song.fts_col
IS 'aggregation of name, artist and album columns to be indexed for faster trigram search';
CREATE INDEX ON song USING GiST (fts_col gist_trgm_ops);
-- create autoincrement on song.index
ALTER TABLE public.song
ALTER COLUMN index ADD GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 0 MINVALUE 0 );```