summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-05-12 13:36:20 +0200
committerDouwe Maan <douwe@gitlab.com>2015-05-12 13:36:20 +0200
commit8acd705c8a2ac73c4c0c780e6ce0b4532dca3b59 (patch)
treee51aac4cfb7e928f78b6515ece89e2fd248095bf
parentb0b25e37c9fee9a0eda1d87e418b2e4794742659 (diff)
downloadgitlab-ce-remove-mysql-index-conversion-from-docs.tar.gz
Update docs in line with mysql-postgresql-converter changes.remove-mysql-index-conversion-from-docs
-rw-r--r--doc/update/mysql_to_postgresql.md55
1 files changed, 4 insertions, 51 deletions
diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md
index 50941db25f6..2c43cf59c1f 100644
--- a/doc/update/mysql_to_postgresql.md
+++ b/doc/update/mysql_to_postgresql.md
@@ -1,7 +1,7 @@
# Migrating GitLab from MySQL to Postgres
*Make sure you view this [guide from the `master` branch](../../../master/doc/update/mysql_to_postgresql.md) for the most up to date instructions.*
-If you are replacing MySQL with Postgres while keeping GitLab on the same server all you need to do is to export from MySQL, import into Postgres and rebuild the indexes as described below. If you are also moving GitLab to another server, or if you are switching to omnibus-gitlab, you may want to use a GitLab backup file. The second part of this documents explains the procedure to do this.
+If you are replacing MySQL with Postgres while keeping GitLab on the same server all you need to do is to export from MySQL, convert the resulting SQL file, and import it into Postgres. If you are also moving GitLab to another server, or if you are switching to omnibus-gitlab, you may want to use a GitLab backup file. The second part of this documents explains the procedure to do this.
## Export from MySQL and import into Postgres
@@ -14,13 +14,11 @@ sudo service gitlab stop
git clone https://github.com/gitlabhq/mysql-postgresql-converter.git -b gitlab
cd mysql-postgresql-converter
-mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root gitlabhq_production -p
-python db_converter.py databasename.mysql databasename.psql
+mysqldump --compatible=postgresql --default-character-set=utf8 -r gitlabhq_production.mysql -u root gitlabhq_production -p
+python db_converter.py gitlabhq_production.mysql gitlabhq_production.psql
# Import the database dump as the application database user
-sudo -u git psql -f databasename.psql -d gitlabhq_production
-
-# Rebuild indexes (see below)
+sudo -u git psql -f gitlabhq_production.psql -d gitlabhq_production
# Install gems for PostgreSQL (note: the line below states '--without ... mysql')
sudo -u git -H bundle install --without development test mysql --deployment
@@ -28,51 +26,6 @@ sudo -u git -H bundle install --without development test mysql --deployment
sudo service gitlab start
```
-## Rebuild indexes
-
-The lanyrd database converter script does not preserve all indexes, so we have to recreate them ourselves after migrating from MySQL. It is not necessary to shut down GitLab for this process.
-
-### For non-omnibus installations
-
-On non-omnibus installations (distributed using Git) we retrieve the index declarations from version control using `git stash`.
-
-```
-# Clone the database converter on your Postgres-backed GitLab server
-cd /tmp
-git clone https://github.com/gitlabhq/mysql-postgresql-converter.git -b gitlab
-
-cd /home/git/gitlab
-
-# Stash changes to db/schema.rb to make sure we can find the right index statements
-sudo -u git -H git stash
-
-# Generate add_index.rb
-ruby /tmp/mysql-postgresql-converter/add_index_statements.rb db/schema.rb > /tmp/mysql-postgresql-converter/add_index.rb
-
-# Create the indexes
-sudo -u git -H bundle exec rails runner -e production 'eval $stdin.read' < /tmp/mysql-postgresql-converter/add_index.rb
-```
-
-### For omnibus-gitlab installations
-
-On omnibus-gitlab we need to get the index declarations from a file called `schema.rb.bundled`. For versions older than 6.9, we need to download the file.
-
-```
-# Clone the database converter on your Postgres-backed GitLab server
-cd /tmp
-/opt/gitlab/embedded/bin/git clone https://github.com/gitlabhq/mysql-postgresql-converter.git -b gitlab
-cd /tmp/mysql-postgresql-converter
-
-# Download schema.rb.bundled if necessary
-test -e /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb.bundled || sudo /opt/gitlab/embedded/bin/curl -o /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb.bundled https://gitlab.com/gitlab-org/gitlab-ce/raw/v6.9.1/db/schema.rb
-
-# Generate add_index.rb
-/opt/gitlab/embedded/bin/ruby add_index_statements.rb /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb.bundled > add_index.rb
-
-# Create the indexes
-/opt/gitlab/bin/gitlab-rails runner 'eval $stdin.read' < add_index.rb
-```
-
## Converting a GitLab backup file from MySQL to Postgres
**Note:** Please make sure to have Python 2.7.x (or higher) installed.