mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 14:36:52 +00:00
migration - add some documentation on limits regarding the database owner name
Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
parent
4750fb228f
commit
8ae4ec52a3
2 changed files with 6 additions and 5 deletions
|
|
@ -91,10 +91,10 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO
|
||||||
# Get the Owner
|
# Get the Owner
|
||||||
DB_OWNER="$(grep "$GREP_STRING" "$DUMP_FILE" | grep -oP 'Owner:.*$' | sed 's|Owner:||;s| ||g')"
|
DB_OWNER="$(grep "$GREP_STRING" "$DUMP_FILE" | grep -oP 'Owner:.*$' | sed 's|Owner:||;s| ||g')"
|
||||||
if [ "$DB_OWNER" = "$POSTGRES_USER" ]; then
|
if [ "$DB_OWNER" = "$POSTGRES_USER" ]; then
|
||||||
DIFFERENT_DB_OWNER=1
|
echo "Unfortunately was the found database owner of the dump file the same as the POSTGRES_USER $POSTGRES_USER"
|
||||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
echo "It is not possible to import a database dump from this database owner."
|
||||||
ALTER DATABASE "$POSTGRES_DB" OWNER TO "$POSTGRES_USER";
|
echo "However you might rename the owner in the dumpfile to something else."
|
||||||
EOSQL
|
exit 1
|
||||||
elif [ "$DB_OWNER" != "oc_$POSTGRES_USER" ]; then
|
elif [ "$DB_OWNER" != "oc_$POSTGRES_USER" ]; then
|
||||||
DIFFERENT_DB_OWNER=1
|
DIFFERENT_DB_OWNER=1
|
||||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,8 @@ The procedure for migrating the files and the database works like this:
|
||||||
1. Type in `local::/your/old/datadir/` which should bring up the exact line where you need to modify the path to use the one used in Nextcloud AIO, instead.
|
1. Type in `local::/your/old/datadir/` which should bring up the exact line where you need to modify the path to use the one used in Nextcloud AIO, instead.
|
||||||
1. Change it to look like this: `local::/mnt/ncdata/`.
|
1. Change it to look like this: `local::/mnt/ncdata/`.
|
||||||
1. Now save the file by pressing `[CTRL] + [o]` then `[ENTER]` and close nano by pressing `[CTRL] + [x]`
|
1. Now save the file by pressing `[CTRL] + [o]` then `[ENTER]` and close nano by pressing `[CTRL] + [x]`
|
||||||
1. In order to make sure that everything is good, you can now run `grep "/your/old/datadir" database-dump.sql` which should not bring up further results.
|
1. In order to make sure that everything is good, you can now run `grep "/your/old/datadir" database-dump.sql` which should not bring up further results.<br>
|
||||||
|
1. **Please note:** Unfortunately it is not possible to import a database dump from a former database owner with the name `nextcloud`. You can check if that is the case with this command: `grep "Name: oc_appconfig; Type: TABLE; Schema: public; Owner:" database-dump.sql | grep -oP 'Owner:.*$' | sed 's|Owner:||;s| ||g'`. If it returns `nextcloud`, you need to rename the owner in the dump file manually. A command like the following should work, however please note that it is possible that it will overwrite wrong lines. You can thus first check which lines it will change with `grep "Owner: nextcloud$" database-dump.sql`. If only correct looking lines get returned, feel free to change them with `sed -i 's|Owner: nextcloud$|Owner: ncadmin|'`.
|
||||||
1. Next, copy the database dump into the correct place and prepare the database container which will import from the database dump automatically the next container start:
|
1. Next, copy the database dump into the correct place and prepare the database container which will import from the database dump automatically the next container start:
|
||||||
```
|
```
|
||||||
sudo rm /var/lib/docker/volumes/nextcloud_aio_database_dump/_data/database-dump.sql
|
sudo rm /var/lib/docker/volumes/nextcloud_aio_database_dump/_data/database-dump.sql
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue