chore(*.psql/*.sql): update all *.psql to *.sql files
This commit is contained in:
parent
c9015a7f2b
commit
fc37600b8b
63 changed files with 21 additions and 41 deletions
28
package-lock.json
generated
28
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "coryd.dev",
|
"name": "coryd.dev",
|
||||||
"version": "3.4.0",
|
"version": "3.4.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "coryd.dev",
|
"name": "coryd.dev",
|
||||||
"version": "3.4.0",
|
"version": "3.4.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"html-minifier-terser": "7.2.0",
|
"html-minifier-terser": "7.2.0",
|
||||||
|
@ -149,9 +149,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@11ty/eleventy-dev-server/node_modules/@11ty/eleventy-utils": {
|
"node_modules/@11ty/eleventy-dev-server/node_modules/@11ty/eleventy-utils": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-2.0.5.tgz",
|
||||||
"integrity": "sha512-Lh/QxwoG10ElkO4WZlwlEqM/d58sreVfJ+I8bcL+QEwb5cGNHTuOlBnyZ2zcBKJohHINuo4zGMVrN83LBLIAaw==",
|
"integrity": "sha512-onKf5DMcS5Ebs5z40XfTFVu1IWFd6ILmtQE9kpduBNKLdA5SnC22JUREMaFzRpvXSo5PnOvlttSpfyh7EDkqag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
@ -203,9 +203,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@11ty/eleventy-plugin-bundle/node_modules/@11ty/eleventy-utils": {
|
"node_modules/@11ty/eleventy-plugin-bundle/node_modules/@11ty/eleventy-utils": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-2.0.5.tgz",
|
||||||
"integrity": "sha512-Lh/QxwoG10ElkO4WZlwlEqM/d58sreVfJ+I8bcL+QEwb5cGNHTuOlBnyZ2zcBKJohHINuo4zGMVrN83LBLIAaw==",
|
"integrity": "sha512-onKf5DMcS5Ebs5z40XfTFVu1IWFd6ILmtQE9kpduBNKLdA5SnC22JUREMaFzRpvXSo5PnOvlttSpfyh7EDkqag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
@ -1081,9 +1081,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/caniuse-lite": {
|
"node_modules/caniuse-lite": {
|
||||||
"version": "1.0.30001715",
|
"version": "1.0.30001716",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001715.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001716.tgz",
|
||||||
"integrity": "sha512-7ptkFGMm2OAOgvZpwgA4yjQ5SQbrNVGdRjzH0pBdy1Fasvcr+KAeECmbCAECzTuDuoX0FCY8KzUxjf9+9kfZEw==",
|
"integrity": "sha512-49/c1+x3Kwz7ZIWt+4DvK3aMJy9oYXXG6/97JKsnjdCk/6n9vVyWL8NAwVt95Lwt9eigI10Hl782kDfZUUlRXw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -1805,9 +1805,9 @@
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/electron-to-chromium": {
|
"node_modules/electron-to-chromium": {
|
||||||
"version": "1.5.143",
|
"version": "1.5.145",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.143.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.145.tgz",
|
||||||
"integrity": "sha512-QqklJMOFBMqe46k8iIOwA9l2hz57V2OKMmP5eSWcUvwx+mASAsbU+wkF1pHjn9ZVSBPrsYWr4/W/95y5SwYg2g==",
|
"integrity": "sha512-pZ5EcTWRq/055MvSBgoFEyKf2i4apwfoqJbK/ak2jnFq8oHjZ+vzc3AhRcz37Xn+ZJfL58R666FLJx0YOK9yTw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "coryd.dev",
|
"name": "coryd.dev",
|
||||||
"version": "3.4.0",
|
"version": "3.4.1",
|
||||||
"description": "The source for my personal site. Built using 11ty (and other tools).",
|
"description": "The source for my personal site. Built using 11ty (and other tools).",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
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;
|
|
||||||
$$ LANGUAGE plpgsql IMMUTABLE;
|
|
6
queries/functions/slugify.sql
Normal file
6
queries/functions/slugify.sql
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
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;
|
||||||
|
$$ LANGUAGE plpgsql IMMUTABLE;
|
|
@ -6,21 +6,17 @@ DECLARE
|
||||||
last_read DATE;
|
last_read DATE;
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT (NOW() AT TIME ZONE 'America/Los_Angeles')::DATE INTO pacific_today;
|
SELECT (NOW() AT TIME ZONE 'America/Los_Angeles')::DATE INTO pacific_today;
|
||||||
|
|
||||||
SELECT COALESCE(last_read_date::DATE, pacific_today - INTERVAL '1 day') INTO last_read FROM reading_streak LIMIT 1;
|
SELECT COALESCE(last_read_date::DATE, pacific_today - INTERVAL '1 day') INTO last_read FROM reading_streak LIMIT 1;
|
||||||
|
|
||||||
IF last_read < pacific_today - INTERVAL '1 day' THEN
|
IF last_read < pacific_today - INTERVAL '1 day' THEN
|
||||||
UPDATE reading_streak
|
UPDATE reading_streak
|
||||||
SET days_read = 0, last_read_date = NOW() AT TIME ZONE 'America/Los_Angeles'
|
SET days_read = 0, last_read_date = NOW() AT TIME ZONE 'America/Los_Angeles'
|
||||||
WHERE id = 1;
|
WHERE id = 1;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF last_read IS DISTINCT FROM pacific_today THEN
|
IF last_read IS DISTINCT FROM pacific_today THEN
|
||||||
UPDATE reading_streak
|
UPDATE reading_streak
|
||||||
SET days_read = days_read + 1, last_read_date = NOW() AT TIME ZONE 'America/Los_Angeles'
|
SET days_read = days_read + 1, last_read_date = NOW() AT TIME ZONE 'America/Los_Angeles'
|
||||||
WHERE id = 1;
|
WHERE id = 1;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
|
@ -5,7 +5,6 @@ BEGIN
|
||||||
SET status = 'aired'
|
SET status = 'aired'
|
||||||
WHERE air_date < CURRENT_DATE
|
WHERE air_date < CURRENT_DATE
|
||||||
AND status = 'upcoming';
|
AND status = 'upcoming';
|
||||||
|
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
|
@ -6,7 +6,6 @@ BEGIN
|
||||||
WHERE show_id = NEW.show
|
WHERE show_id = NEW.show
|
||||||
AND season_number = NEW.season_number
|
AND season_number = NEW.season_number
|
||||||
AND episode_number = NEW.episode_number;
|
AND episode_number = NEW.episode_number;
|
||||||
|
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
|
@ -2,12 +2,10 @@ BEGIN
|
||||||
UPDATE artists
|
UPDATE artists
|
||||||
SET total_plays = total_plays - 1
|
SET total_plays = total_plays - 1
|
||||||
WHERE name_string = OLD.artist_name;
|
WHERE name_string = OLD.artist_name;
|
||||||
|
|
||||||
UPDATE albums
|
UPDATE albums
|
||||||
SET total_plays = total_plays - 1
|
SET total_plays = total_plays - 1
|
||||||
WHERE name = OLD.album_name
|
WHERE name = OLD.album_name
|
||||||
AND artist_name = OLD.artist_name;
|
AND artist_name = OLD.artist_name;
|
||||||
|
|
||||||
UPDATE genres
|
UPDATE genres
|
||||||
SET total_plays = total_plays - 1
|
SET total_plays = total_plays - 1
|
||||||
WHERE id = (
|
WHERE id = (
|
||||||
|
@ -15,6 +13,5 @@ BEGIN
|
||||||
FROM artists
|
FROM artists
|
||||||
WHERE name_string = OLD.artist_name
|
WHERE name_string = OLD.artist_name
|
||||||
);
|
);
|
||||||
|
|
||||||
RETURN OLD;
|
RETURN OLD;
|
||||||
END;
|
END;
|
|
@ -4,7 +4,6 @@ BEGIN
|
||||||
IF NEW.air_date < CURRENT_DATE AND NEW.status = 'upcoming' THEN
|
IF NEW.air_date < CURRENT_DATE AND NEW.status = 'upcoming' THEN
|
||||||
NEW.status := 'aired';
|
NEW.status := 'aired';
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
|
@ -2,12 +2,10 @@ BEGIN
|
||||||
UPDATE artists
|
UPDATE artists
|
||||||
SET total_plays = total_plays + 1
|
SET total_plays = total_plays + 1
|
||||||
WHERE name_string = NEW.artist_name;
|
WHERE name_string = NEW.artist_name;
|
||||||
|
|
||||||
UPDATE albums
|
UPDATE albums
|
||||||
SET total_plays = total_plays + 1
|
SET total_plays = total_plays + 1
|
||||||
WHERE key = NEW.album_key
|
WHERE key = NEW.album_key
|
||||||
AND artist_name = NEW.artist_name;
|
AND artist_name = NEW.artist_name;
|
||||||
|
|
||||||
UPDATE genres
|
UPDATE genres
|
||||||
SET total_plays = total_plays + 1
|
SET total_plays = total_plays + 1
|
||||||
WHERE id = (
|
WHERE id = (
|
||||||
|
@ -15,6 +13,5 @@ BEGIN
|
||||||
FROM artists
|
FROM artists
|
||||||
WHERE name_string = NEW.artist_name
|
WHERE name_string = NEW.artist_name
|
||||||
);
|
);
|
||||||
|
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
END;
|
END;
|
Loading…
Add table
Add a link
Reference in a new issue