Commit bc62c283c6f769a8f82842d13e909209296c4d3b

Authored by Jacob Vosmaer
1 parent b7de9de4

Download schema.rb.bundled if necessary

Showing 1 changed file with 7 additions and 6 deletions   Show diff stats
doc/update/mysql_to_postgresql.md
@@ -35,9 +35,9 @@ to recreate them ourselves after migrating from MySQL. It is not necessary to @@ -35,9 +35,9 @@ to recreate them ourselves after migrating from MySQL. It is not necessary to
35 shut down GitLab for this process. 35 shut down GitLab for this process.
36 36
37 37
38 -### For source installations 38 +### For non-omnibus installations
39 39
40 -On source installations (distributed using Git) we retrieve the index 40 +On non-omnibus installations (distributed using Git) we retrieve the index
41 declarations from version control using `git stash`. 41 declarations from version control using `git stash`.
42 42
43 ``` 43 ```
@@ -60,7 +60,7 @@ sudo -u git -H bundle exec rails runner -e production 'eval $stdin.read' < /tmp/ @@ -60,7 +60,7 @@ sudo -u git -H bundle exec rails runner -e production 'eval $stdin.read' < /tmp/
60 ### For omnibus-gitlab installations 60 ### For omnibus-gitlab installations
61 61
62 On omnibus-gitlab we need to get the index declarations from a file called 62 On omnibus-gitlab we need to get the index declarations from a file called
63 -`schema.rb.bundled`. For older versions, we need to download the file. 63 +`schema.rb.bundled`. For versions older than 6.9, we need to download the file.
64 64
65 ``` 65 ```
66 # Clone the database converter on your Postgres-backed GitLab server 66 # Clone the database converter on your Postgres-backed GitLab server
@@ -68,12 +68,13 @@ cd /tmp @@ -68,12 +68,13 @@ cd /tmp
68 /opt/gitlab/embedded/bin/git clone https://github.com/gitlabhq/mysql-postgresql-converter.git 68 /opt/gitlab/embedded/bin/git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
69 cd /tmp/mysql-postgresql-converter 69 cd /tmp/mysql-postgresql-converter
70 70
  71 +# Download schema.rb.bundled if necessary
  72 +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
  73 +
71 # Generate add_index.rb 74 # Generate add_index.rb
72 /opt/gitlab/embedded/bin/ruby add_index_statements.rb /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb.bundled > add_index.rb 75 /opt/gitlab/embedded/bin/ruby add_index_statements.rb /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb.bundled > add_index.rb
73 76
74 -# If schema.rb.bundled does not exist, download it as follows, then try generating add_index.rb again  
75 -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  
76 - 77 +# Create the indexes
77 /opt/gitlab/bin/gitlab-rails runner 'eval $stdin.read' < add_index.rb 78 /opt/gitlab/bin/gitlab-rails runner 'eval $stdin.read' < add_index.rb
78 ``` 79 ```
79 80