Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-06-01 10:52:19 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2017-06-01 17:34:48 +0300
commit6185d12c183b539ea06ab3550b2c21045d169ca4 (patch)
tree9a5a8e50f8b0c6c64d69099d0374dc15ace808ee /db
parente61f38d79eb85a7c601bd146d5b8e48a8b4418e5 (diff)
Add missing specs
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20170523083112_migrate_old_artifacts.rb10
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