variable postgres username and database name (#2451)
This commit is contained in:
parent
b10f37bea9
commit
df968d1919
12 changed files with 70 additions and 41 deletions
|
@ -1,4 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
psql invidious kemal -c "ALTER TABLE channels ADD COLUMN subscribed bool;"
|
[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
|
||||||
psql invidious kemal -c "UPDATE channels SET subscribed = false;"
|
[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
|
||||||
|
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE channels ADD COLUMN subscribed bool;"
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "UPDATE channels SET subscribed = false;"
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
psql invidious kemal -c "ALTER TABLE channel_videos DROP COLUMN live_now CASCADE"
|
[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
|
||||||
psql invidious kemal -c "ALTER TABLE channel_videos DROP COLUMN premiere_timestamp CASCADE"
|
[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
|
||||||
|
|
||||||
psql invidious kemal -c "ALTER TABLE channel_videos ADD COLUMN live_now bool"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE channel_videos DROP COLUMN live_now CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE channel_videos ADD COLUMN premiere_timestamp timestamptz"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE channel_videos DROP COLUMN premiere_timestamp CASCADE"
|
||||||
|
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE channel_videos ADD COLUMN live_now bool"
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE channel_videos ADD COLUMN premiere_timestamp timestamptz"
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN title CASCADE"
|
[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN views CASCADE"
|
[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN likes CASCADE"
|
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN dislikes CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN title CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN wilson_score CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN views CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN published CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN likes CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN description CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN dislikes CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN language CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN wilson_score CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN author CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN published CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN ucid CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN description CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN allowed_regions CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN language CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN is_family_friendly CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN author CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN genre CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN ucid CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN genre_url CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN allowed_regions CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN license CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN is_family_friendly CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN sub_count_text CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN genre CASCADE"
|
||||||
psql invidious kemal -c "ALTER TABLE videos DROP COLUMN author_thumbnail CASCADE"
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN genre_url CASCADE"
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN license CASCADE"
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN sub_count_text CASCADE"
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN author_thumbnail CASCADE"
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
psql invidious kemal -c "ALTER TABLE channels ADD COLUMN deleted bool;"
|
[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
|
||||||
psql invidious kemal -c "UPDATE channels SET deleted = false;"
|
[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
|
||||||
|
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE channels ADD COLUMN deleted bool;"
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "UPDATE channels SET deleted = false;"
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
psql invidious kemal < config/sql/session_ids.sql
|
[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
|
||||||
psql invidious kemal -c "INSERT INTO session_ids (SELECT unnest(id), email, CURRENT_TIMESTAMP FROM users) ON CONFLICT (id) DO NOTHING"
|
[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
|
||||||
psql invidious kemal -c "ALTER TABLE users DROP COLUMN id"
|
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" < config/sql/session_ids.sql
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "INSERT INTO session_ids (SELECT unnest(id), email, CURRENT_TIMESTAMP FROM users) ON CONFLICT (id) DO NOTHING"
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE users DROP COLUMN id"
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
psql invidious kemal < config/sql/annotations.sql
|
[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
|
||||||
|
[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
|
||||||
|
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" < config/sql/annotations.sql
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
psql invidious kemal -c "ALTER TABLE channel_videos ADD COLUMN views bigint;"
|
[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
|
||||||
|
[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
|
||||||
|
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE channel_videos ADD COLUMN views bigint;"
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
psql invidious kemal -c "ALTER TABLE channel_videos ADD COLUMN live_now bool;"
|
[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
|
||||||
psql invidious kemal -c "UPDATE channel_videos SET live_now = false;"
|
[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
|
||||||
|
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE channel_videos ADD COLUMN live_now bool;"
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "UPDATE channel_videos SET live_now = false;"
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
psql invidious kemal -c "ALTER TABLE users ADD COLUMN feed_needs_update boolean"
|
[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
|
||||||
|
[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
|
||||||
|
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE users ADD COLUMN feed_needs_update boolean"
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
psql invidious kemal -c "ALTER TABLE channel_videos ADD COLUMN premiere_timestamp timestamptz;"
|
[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
|
||||||
|
[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
|
||||||
|
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE channel_videos ADD COLUMN premiere_timestamp timestamptz;"
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
psql invidious kemal -c "ALTER TABLE channels DROP COLUMN subscribed"
|
[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
|
||||||
psql invidious kemal -c "ALTER TABLE channels ADD COLUMN subscribed timestamptz"
|
[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
|
||||||
psql invidious kemal -c "UPDATE channels SET subscribed = '2019-01-01 00:00:00+00'"
|
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE channels DROP COLUMN subscribed"
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE channels ADD COLUMN subscribed timestamptz"
|
||||||
|
psql "$POSTGRES_DB" "$POSTGRES_USER" -c "UPDATE channels SET subscribed = '2019-01-01 00:00:00+00'"
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
|
|
||||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
|
||||||
CREATE USER postgres;
|
|
||||||
EOSQL
|
|
||||||
|
|
||||||
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/channels.sql
|
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/channels.sql
|
||||||
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/videos.sql
|
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/videos.sql
|
||||||
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/channel_videos.sql
|
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/channel_videos.sql
|
||||||
|
|
Loading…
Reference in a new issue