diff options
-rw-r--r-- | db/migrate/20160331204039_add_action_to_ci_commit.rb | 5 | ||||
-rw-r--r-- | db/migrate/20160411122626_add_duration_to_ci_commit.rb | 5 | ||||
-rw-r--r-- | db/migrate/20160412173416_add_fields_to_ci_commit.rb (renamed from db/migrate/20160331153918_add_fields_to_ci_commit.rb) | 1 | ||||
-rw-r--r-- | db/migrate/20160412173417_update_ci_commit.rb (renamed from db/migrate/20160412175417_update_ci_commit.rb) | 4 | ||||
-rw-r--r-- | db/migrate/20160412173418_add_ci_commit_indexes.rb (renamed from db/migrate/20160412174954_add_ci_commit_indexes.rb) | 2 |
5 files changed, 7 insertions, 10 deletions
diff --git a/db/migrate/20160331204039_add_action_to_ci_commit.rb b/db/migrate/20160331204039_add_action_to_ci_commit.rb deleted file mode 100644 index e9f8eb624d6..00000000000 --- a/db/migrate/20160331204039_add_action_to_ci_commit.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddActionToCiCommit < ActiveRecord::Migration - def change - add_column :ci_commits, :action, :string - end -end diff --git a/db/migrate/20160411122626_add_duration_to_ci_commit.rb b/db/migrate/20160411122626_add_duration_to_ci_commit.rb deleted file mode 100644 index 7def7a48cde..00000000000 --- a/db/migrate/20160411122626_add_duration_to_ci_commit.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDurationToCiCommit < ActiveRecord::Migration - def change - add_column :ci_commits, :duration, :integer - end -end diff --git a/db/migrate/20160331153918_add_fields_to_ci_commit.rb b/db/migrate/20160412173416_add_fields_to_ci_commit.rb index 03eb9ba4e53..125956a3ddd 100644 --- a/db/migrate/20160331153918_add_fields_to_ci_commit.rb +++ b/db/migrate/20160412173416_add_fields_to_ci_commit.rb @@ -3,5 +3,6 @@ class AddFieldsToCiCommit < ActiveRecord::Migration add_column :ci_commits, :status, :string add_column :ci_commits, :started_at, :timestamp add_column :ci_commits, :finished_at, :timestamp + add_column :ci_commits, :duration, :integer end end diff --git a/db/migrate/20160412175417_update_ci_commit.rb b/db/migrate/20160412173417_update_ci_commit.rb index ebe1d143b1f..fd92444dbac 100644 --- a/db/migrate/20160412175417_update_ci_commit.rb +++ b/db/migrate/20160412173417_update_ci_commit.rb @@ -1,8 +1,12 @@ class UpdateCiCommit < ActiveRecord::Migration + # This migration can be run online, but needs to be executed for the second time after restarting Unicorn workers + # Otherwise Offline migration should be used. def change execute("UPDATE ci_commits SET status=#{status}, ref=#{ref}, tag=#{tag} WHERE status IS NULL") end + private + def status builds = '(SELECT COUNT(*) FROM ci_builds WHERE ci_builds.commit_id=ci_commits.id)' success = "(SELECT COUNT(*) FROM ci_builds WHERE ci_builds.commit_id=ci_commits.id AND status='success')" diff --git a/db/migrate/20160412174954_add_ci_commit_indexes.rb b/db/migrate/20160412173418_add_ci_commit_indexes.rb index 4cb61333178..c1e238bc021 100644 --- a/db/migrate/20160412174954_add_ci_commit_indexes.rb +++ b/db/migrate/20160412173418_add_ci_commit_indexes.rb @@ -7,6 +7,8 @@ class AddCiCommitIndexes < ActiveRecord::Migration add_index :ci_commits, [:status], index_options end + private + def index_options { algorithm: :concurrently } if Gitlab::Database.postgresql? end |