Commit graph

9 commits

Author SHA1 Message Date
Jacob Vosmaer
77b57c114b Drop all tables before restoring a PostgreSQL DB
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.
2014-03-28 13:44:46 +01:00
Jacob Vosmaer
8fe10e642a Empty the database during Postgres backup restore
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.
2014-02-26 18:26:31 +01:00
Jacob Vosmaer
9e6fc8b526 Report failure of DB backup commands 2014-01-23 11:19:43 +01:00
Jacob Vosmaer
a540ab4290 Remove Bourne shell from backup code 2013-11-06 14:02:28 +01:00
Dmitriy Zaporozhets
f9b66aecdd Revert "More escaping"
This reverts commit c46eaca912.
2013-11-05 15:35:49 +02:00
Nigel Kukard
c46eaca912 More escaping
- 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>
2013-11-04 22:09:03 +00:00
andrewwutw
b898372154 Fix PostgreSQL database restoration problem (#4217)
Use psql instead of pg_restore to restore SQL dump file.
2013-06-10 19:06:12 +08:00
Axilleas Pipinellis
13dcc390cb Fix errors during backup task. Fix #3785
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>
2013-05-07 14:44:49 +03:00
Dmitriy Zaporozhets
c33d5e16fe refactor backup/restore 2013-04-05 19:01:19 +03:00