Commit 840b4c935af30859b23134454154e6c4dbbef7da
1 parent
1064b242
Exists in
master
and in
11 other branches
Run `rake db:migrate` only on VERSION changes
Showing
3 changed files
with
13 additions
and
3 deletions
Show diff stats
CHANGELOG
files/gitlab-cookbooks/gitlab/recipes/database_migrations.rb
... | ... | @@ -20,9 +20,7 @@ execute "initialize database" do |
20 | 20 | action :nothing |
21 | 21 | end |
22 | 22 | |
23 | -user_group = "#{node['gitlab']['user']['username']}:#{node['gitlab']['user']['group']}" | |
24 | -execute "chown #{user_group} /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb" | |
25 | - | |
26 | 23 | execute "migrate database" do |
27 | 24 | command "/opt/gitlab/bin/gitlab-rake db:migrate" |
25 | + action :nothing | |
28 | 26 | end | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb
... | ... | @@ -114,6 +114,17 @@ end |
114 | 114 | end |
115 | 115 | end |
116 | 116 | |
117 | +# Make schema.rb writable for when we run `rake db:migrate` | |
118 | +file "/opt/gitlab/embedded/service/gitlab-rails/db/schema.rb" do | |
119 | + owner node['gitlab']['user']['username'] | |
120 | +end | |
121 | + | |
122 | +# Only run `rake db:migrate` when the gitlab-rails version has changed | |
123 | +remote_file File.join(gitlab_rails_dir, 'VERSION') do | |
124 | + source "file:///opt/gitlab/embedded/service/gitlab-rails/VERSION" | |
125 | + notifies :run, 'execute[migrate database]' | |
126 | +end | |
127 | + | |
117 | 128 | execute "chown -R #{node['gitlab']['user']['username']} /opt/gitlab/embedded/service/gitlab-rails/public" |
118 | 129 | |
119 | 130 | execute "clear the gitlab-rails cache" do | ... | ... |