summaryrefslogtreecommitdiffstats
path: root/config/migrate-scripts/migrate-db-1eca969.sh
diff options
context:
space:
mode:
authorJuniorJPDJ <github.com@juniorjpdj.pl>2021-10-11 21:16:56 +0200
committerGitHub <noreply@github.com>2021-10-11 19:16:56 +0000
commitdf968d1919227949bcbeedb253d66ed0720b3d2a (patch)
treec4192c127e45c039fbc8478033bd0cb715a41326 /config/migrate-scripts/migrate-db-1eca969.sh
parentb10f37bea972fde6586639511bf8eaab490581fd (diff)
downloadinvidious-df968d1919227949bcbeedb253d66ed0720b3d2a.tar.gz
invidious-df968d1919227949bcbeedb253d66ed0720b3d2a.tar.bz2
invidious-df968d1919227949bcbeedb253d66ed0720b3d2a.zip
variable postgres username and database name (#2451)
Diffstat (limited to 'config/migrate-scripts/migrate-db-1eca969.sh')
-rwxr-xr-xconfig/migrate-scripts/migrate-db-1eca969.sh37
1 files changed, 20 insertions, 17 deletions
diff --git a/config/migrate-scripts/migrate-db-1eca969.sh b/config/migrate-scripts/migrate-db-1eca969.sh
index f840d924..770a76d3 100755
--- a/config/migrate-scripts/migrate-db-1eca969.sh
+++ b/config/migrate-scripts/migrate-db-1eca969.sh
@@ -1,19 +1,22 @@
#!/bin/sh
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN title CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN views CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN likes CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN dislikes CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN wilson_score CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN published CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN description CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN language CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN author CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN ucid CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN allowed_regions CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN is_family_friendly CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN genre CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN genre_url CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN license CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN sub_count_text CASCADE"
-psql invidious kemal -c "ALTER TABLE videos DROP COLUMN author_thumbnail CASCADE"
+[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
+[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
+
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN title CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN views CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN likes CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN dislikes CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN wilson_score CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN published CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN description CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN language CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN author CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN ucid CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN allowed_regions CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN is_family_friendly CASCADE"
+psql "$POSTGRES_DB" "$POSTGRES_USER" -c "ALTER TABLE videos DROP COLUMN genre 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"