The change in baa157926d broke backup
restore fucnctionality. This would not lead to data loss, but it
prevented the restore script from working. This bug exists only in
7.14.0 release candidate versions, not in 7.13.
Reported in https://github.com/gitlabhq/gitlabhq/issues/9571 .
The existing behavior of the backups is to overwrite whatever data
was still there in the scratch directories. This broke when we added
a 'gzip' step because 'gzip database.sql' will fail if 'database.sql.gz'
already exists. Doing 'rm -f database.sql.gz' before the 'gzip'
avoids this failure.
Use native Postgres database cleaning during backup restore
We were using hacks to drop tables etc during a Postgres backup
restore. With this change, we let pg_dump insert the DROP TABLE
statements it needs at the start of the SQL dump.
See merge request !1891
We were using hacks to drop tables etc during a Postgres backup
restore. With this change, we let pg_dump insert the DROP TABLE
statements it needs at the start of the SQL dump.
Invoking 'db:schema:load' turned out to be a bad idea: when downgrading
an existing GitLab installation, the schema of the newer version would
be preserved when trying to import the old version.
The expected behavior during a GitLab backup restore is to overwrite
existing database data. This works for MySQL because the output of
mysqldump contains 'DROP TABLE IF EXISTS' statements. pg_dump on the
other hand assumes that one will restore into an empty database. When
this is not the case, during the restore with psql some of the data will
be skipped if existing data is 'in the way'. By first invoking `rake
db:schema:load` during a Postgres GitLab backup restore, we make sure
that all important data is correctly restored.
- Database name may contain characters which are not shell friendly
- Database password could contain the same
- While we at it there is no harm in escaping generated paths too
- Refactored 2-line system(command)
Signed-off-by: Nigel Kukard <nkukard@lbsd.net>
By default there is no public/uploads directory when no attachments
are uploaded. Prompt users to create the uploads directory during
install otherwise the backup task will fail.
Place mysqldump args in single quotes to avoid error if password
contains special characters.
Signed-off-by: Axilleas Pipinellis <axilleas@archlinux.gr>