summaryrefslogtreecommitdiffstats
path: root/config/migrate-scripts/migrate-db-8e884fe.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-8e884fe.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-8e884fe.sh')
-rwxr-xr-xconfig/migrate-scripts/migrate-db-8e884fe.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/config/migrate-scripts/migrate-db-8e884fe.sh b/config/migrate-scripts/migrate-db-8e884fe.sh
index 1c8dafd1..0d5de828 100755
--- a/config/migrate-scripts/migrate-db-8e884fe.sh
+++ b/config/migrate-scripts/migrate-db-8e884fe.sh
@@ -1,5 +1,8 @@
#!/bin/sh
-psql invidious kemal -c "ALTER TABLE channels DROP COLUMN subscribed"
-psql invidious kemal -c "ALTER TABLE channels ADD COLUMN subscribed timestamptz"
-psql invidious kemal -c "UPDATE channels SET subscribed = '2019-01-01 00:00:00+00'"
+[ -z "$POSTGRES_USER" ] && POSTGRES_USER=kemal
+[ -z "$POSTGRES_DB" ] && POSTGRES_DB=invidious
+
+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'"