chore(*.sql): use sql-formatter for sql formatting
This commit is contained in:
parent
cf1ee4c97f
commit
1d7f13d1f5
63 changed files with 4432 additions and 2358 deletions
|
@ -1,5 +1,4 @@
|
|||
CREATE OR REPLACE FUNCTION get_feed_data(feed_key TEXT)
|
||||
RETURNS JSON AS $$
|
||||
CREATE OR REPLACE FUNCTION get_feed_data (feed_key TEXT) RETURNS JSON AS $$
|
||||
DECLARE
|
||||
result JSON;
|
||||
sql_query TEXT;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
CREATE OR REPLACE FUNCTION get_tagged_content(
|
||||
CREATE OR REPLACE FUNCTION get_tagged_content (
|
||||
tag_query TEXT,
|
||||
page_size INTEGER DEFAULT 20,
|
||||
page_offset INTEGER DEFAULT 0
|
||||
)
|
||||
RETURNS TABLE (
|
||||
) RETURNS TABLE (
|
||||
tag TEXT,
|
||||
title TEXT,
|
||||
url TEXT,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
CREATE OR REPLACE FUNCTION get_top_tag_groups()
|
||||
RETURNS JSON AS $$
|
||||
CREATE OR REPLACE FUNCTION get_top_tag_groups () RETURNS JSON AS $$
|
||||
BEGIN
|
||||
RETURN json_build_object(
|
||||
'tags', (
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
CREATE OR REPLACE FUNCTION normalize_country_field(countryField TEXT)
|
||||
RETURNS TEXT AS $$
|
||||
CREATE OR REPLACE FUNCTION normalize_country_field (countryField TEXT) RETURNS TEXT AS $$
|
||||
DECLARE
|
||||
delimiters TEXT[] := ARRAY[',', '/', '&', 'and'];
|
||||
countries TEXT[];
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
DROP FUNCTION IF EXISTS search_optimized_index(text, integer, integer, text[]);
|
||||
DROP FUNCTION IF EXISTS search_optimized_index (text, integer, integer, text[]);
|
||||
|
||||
CREATE FUNCTION search_optimized_index(search_query text, page_size integer, page_offset integer, sections text[])
|
||||
RETURNS TABLE(
|
||||
result_id integer,
|
||||
url text,
|
||||
title text,
|
||||
description text,
|
||||
tags text[],
|
||||
genre_name text,
|
||||
genre_url text,
|
||||
section text,
|
||||
type text,
|
||||
total_plays text,
|
||||
rank real,
|
||||
total_count bigint
|
||||
)
|
||||
AS $$
|
||||
CREATE FUNCTION search_optimized_index (
|
||||
search_query text,
|
||||
page_size integer,
|
||||
page_offset integer,
|
||||
sections text[]
|
||||
) RETURNS TABLE (
|
||||
result_id integer,
|
||||
url text,
|
||||
title text,
|
||||
description text,
|
||||
tags text[],
|
||||
genre_name text,
|
||||
genre_url text,
|
||||
section text,
|
||||
type text,
|
||||
total_plays text,
|
||||
rank real,
|
||||
total_count bigint
|
||||
) AS $$
|
||||
BEGIN
|
||||
RETURN QUERY
|
||||
SELECT
|
||||
|
@ -42,5 +45,4 @@ BEGIN
|
|||
rank DESC
|
||||
LIMIT page_size OFFSET page_offset;
|
||||
END;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
CREATE OR REPLACE FUNCTION slugify(input TEXT)
|
||||
RETURNS TEXT AS $$
|
||||
CREATE OR REPLACE FUNCTION slugify (input TEXT) RETURNS TEXT AS $$
|
||||
BEGIN
|
||||
RETURN lower(regexp_replace(unaccent(regexp_replace(input, '[^\w\s-]', '', 'g')), '\s+', '-', 'g'));
|
||||
END;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
CREATE OR REPLACE FUNCTION update_album_key(old_album_key TEXT, new_album_key TEXT)
|
||||
RETURNS void AS $$
|
||||
CREATE OR REPLACE FUNCTION update_album_key (old_album_key TEXT, new_album_key TEXT) RETURNS void AS $$
|
||||
BEGIN
|
||||
UPDATE listens
|
||||
SET album_key = new_album_key
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
CREATE OR REPLACE FUNCTION update_artist_name(old_artist_name TEXT, new_artist_name TEXT)
|
||||
RETURNS void AS $$
|
||||
CREATE OR REPLACE FUNCTION update_artist_name (old_artist_name TEXT, new_artist_name TEXT) RETURNS void AS $$
|
||||
BEGIN
|
||||
UPDATE listens
|
||||
SET artist_name = new_artist_name
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
CREATE OR REPLACE FUNCTION update_days_read()
|
||||
RETURNS TRIGGER AS $$
|
||||
CREATE OR REPLACE FUNCTION update_days_read () RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
pacific_today DATE;
|
||||
last_read DATE;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
CREATE OR REPLACE FUNCTION update_listen_totals()
|
||||
RETURNS void AS $$
|
||||
CREATE OR REPLACE FUNCTION update_listen_totals () RETURNS void AS $$
|
||||
BEGIN
|
||||
WITH artist_plays AS (
|
||||
SELECT artist_name, COUNT(*)::integer AS total_plays
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
CREATE OR REPLACE FUNCTION update_scheduled_episode_status()
|
||||
RETURNS TRIGGER AS $$
|
||||
CREATE OR REPLACE FUNCTION update_scheduled_episode_status () RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
UPDATE scheduled_episodes
|
||||
SET status = 'aired'
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
CREATE OR REPLACE FUNCTION update_scheduled_on_watch()
|
||||
RETURNS TRIGGER AS $$
|
||||
CREATE OR REPLACE FUNCTION update_scheduled_on_watch () RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
UPDATE scheduled_episodes
|
||||
SET status = 'watched'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue