diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-06-01 09:52:19 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-06-01 16:34:48 +0200 |
commit | 6185d12c183b539ea06ab3550b2c21045d169ca4 (patch) | |
tree | 9a5a8e50f8b0c6c64d69099d0374dc15ace808ee /db | |
parent | e61f38d79eb85a7c601bd146d5b8e48a8b4418e5 (diff) | |
download | gitlab-ce-6185d12c183b539ea06ab3550b2c21045d169ca4.tar.gz |
Add missing specs
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20170523083112_migrate_old_artifacts.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/db/post_migrate/20170523083112_migrate_old_artifacts.rb b/db/post_migrate/20170523083112_migrate_old_artifacts.rb index 3067e3d404b..f2690bd0017 100644 --- a/db/post_migrate/20170523083112_migrate_old_artifacts.rb +++ b/db/post_migrate/20170523083112_migrate_old_artifacts.rb @@ -22,7 +22,7 @@ class MigrateOldArtifacts < ActiveRecord::Migration def builds_with_artifacts Build.with_artifacts .joins('JOIN projects ON projects.id = ci_builds.project_id') - .where('ci_builds.id < ?', min_id || 0) + .where('ci_builds.id < ?', min_id) .where('projects.ci_id IS NOT NULL') .select('id', 'created_at', 'project_id', 'projects.ci_id AS ci_id') end @@ -30,18 +30,18 @@ class MigrateOldArtifacts < ActiveRecord::Migration def min_id Build.joins('JOIN projects ON projects.id = ci_builds.project_id') .where('projects.ci_id IS NULL') - .pluck('min(ci_builds.id)') + .pluck('coalesce(min(ci_builds.id), 0)') .first end class Build < ActiveRecord::Base self.table_name = 'ci_builds' - scope :with_artifacts, ->() { where.not(artifacts_file: [nil, '']) } + scope :with_artifacts, -> { where.not(artifacts_file: [nil, '']) } def migrate_artifacts! - return unless File.exists?(source_artifacts_path) - return if File.exists?(target_artifacts_path) + return unless File.exist?(source_artifacts_path) + return if File.exist?(target_artifacts_path) ensure_target_path |