diff options
| author | Omar Roth <omarroth@hotmail.com> | 2019-02-10 12:46:58 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2019-02-10 12:46:58 -0600 |
| commit | a384f6e5fd11824f0227f51b53a6bdbd815d60a9 (patch) | |
| tree | 3233595eb4b6359f994caaa9f1ead68a879c1bbe | |
| parent | 3646395f1d8b200ebd33f3c0b65ad6bbaf0c7156 (diff) | |
| download | invidious-a384f6e5fd11824f0227f51b53a6bdbd815d60a9.tar.gz invidious-a384f6e5fd11824f0227f51b53a6bdbd815d60a9.tar.bz2 invidious-a384f6e5fd11824f0227f51b53a6bdbd815d60a9.zip | |
Add migrate script and update README
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | config/migrate-scripts/migrate-db-3646395.sh | 5 | ||||
| -rw-r--r-- | config/sql/session_ids.sql | 1 | ||||
| -rwxr-xr-x | docker/entrypoint.postgres.sh | 1 |
4 files changed, 8 insertions, 1 deletions
@@ -98,6 +98,7 @@ $ psql invidious < /home/invidious/invidious/config/sql/channels.sql $ psql invidious < /home/invidious/invidious/config/sql/videos.sql $ psql invidious < /home/invidious/invidious/config/sql/channel_videos.sql $ psql invidious < /home/invidious/invidious/config/sql/users.sql +$ psql invidious < /home/invidious/invidious/config/sql/session_ids.sql $ psql invidious < /home/invidious/invidious/config/sql/nonces.sql $ exit ``` @@ -138,6 +139,7 @@ $ psql invidious < config/sql/channels.sql $ psql invidious < config/sql/videos.sql $ psql invidious < config/sql/channel_videos.sql $ psql invidious < config/sql/users.sql +$ psql invidious < config/sql/session_ids.sql $ psql invidious < config/sql/nonces.sql # Setup Invidious diff --git a/config/migrate-scripts/migrate-db-3646395.sh b/config/migrate-scripts/migrate-db-3646395.sh new file mode 100644 index 00000000..38a4f665 --- /dev/null +++ b/config/migrate-scripts/migrate-db-3646395.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +psql invidious < config/sql/session_ids.sql +psql invidious -c "INSERT INTO session_ids (SELECT unnest(id), email, CURRENT_TIMESTAMP FROM users) ON CONFLICT (id) DO NOTHING" +psql invidious -c "ALTER TABLE users DROP COLUMN id" diff --git a/config/sql/session_ids.sql b/config/sql/session_ids.sql index 24491405..aa689577 100644 --- a/config/sql/session_ids.sql +++ b/config/sql/session_ids.sql @@ -21,4 +21,3 @@ CREATE INDEX session_ids_id_idx USING btree (id COLLATE pg_catalog."default"); -
\ No newline at end of file diff --git a/docker/entrypoint.postgres.sh b/docker/entrypoint.postgres.sh index 9a258dd6..8f987201 100755 --- a/docker/entrypoint.postgres.sh +++ b/docker/entrypoint.postgres.sh @@ -16,6 +16,7 @@ if [ ! -f /var/lib/postgresql/data/setupFinished ]; then su postgres -c 'psql invidious < config/sql/videos.sql' su postgres -c 'psql invidious < config/sql/channel_videos.sql' su postgres -c 'psql invidious < config/sql/users.sql' + su postgres -c 'psql invidious < config/sql/session_ids.sql' su postgres -c 'psql invidious < config/sql/nonces.sql' touch /var/lib/postgresql/data/setupFinished echo "### invidious database setup finished" |
