diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-22 15:09:49 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-22 15:09:49 +0000 |
commit | f2dfd9ee819afb07bf11bd36a5f9d23009be0d39 (patch) | |
tree | edd9468dc9c6c55f9882175fd83a1aadec22edf0 /lib/tasks | |
parent | 058c34839488502fcec48d805b83728f928a318c (diff) | |
download | gitlab-ce-f2dfd9ee819afb07bf11bd36a5f9d23009be0d39.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gitlab/db.rake | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake index e72c5f51ada..69d542a4f02 100644 --- a/lib/tasks/gitlab/db.rake +++ b/lib/tasks/gitlab/db.rake @@ -50,7 +50,7 @@ namespace :gitlab do else # Add post-migrate paths to ensure we mark all migrations as up Gitlab::Database.add_post_migrate_path_to_rails(force: true) - Rake::Task['db:schema:load'].invoke + Rake::Task['db:structure:load'].invoke Rake::Task['db:seed_fu'].invoke end end @@ -78,5 +78,20 @@ namespace :gitlab do else task :setup_ee end + + desc 'This adjusts and cleans db/structure.sql - it runs after db:structure:dump' + task :clean_structure_sql do + structure_file = 'db/structure.sql' + schema = File.read(structure_file) + + File.open(structure_file, 'wb+') do |io| + Gitlab::Database::SchemaCleaner.new(schema).clean(io) + end + end + + # Inform Rake that gitlab:schema:fix_structure_sql should be run every time rake db:structure:dump is run + Rake::Task['db:structure:dump'].enhance do + Rake::Task['gitlab:db:clean_structure_sql'].invoke + end end end |