diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-02 13:46:38 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-05 09:52:35 +0200 |
commit | 546a3c6561fbe967cc37ccc3229b71893cd20c34 (patch) | |
tree | 0828ab3fb82e2b03921a8f4d1f745f430bae4bd6 /db | |
parent | 0de7c83a78711601b40b5a739070da2e3af29b11 (diff) | |
download | gitlab-ce-546a3c6561fbe967cc37ccc3229b71893cd20c34.tar.gz |
Refactor commit and build
Diffstat (limited to 'db')
4 files changed, 24 insertions, 0 deletions
diff --git a/db/migrate/20151002112914_add_stage_idx_to_builds.rb b/db/migrate/20151002112914_add_stage_idx_to_builds.rb new file mode 100644 index 00000000000..68a745ffef4 --- /dev/null +++ b/db/migrate/20151002112914_add_stage_idx_to_builds.rb @@ -0,0 +1,5 @@ +class AddStageIdxToBuilds < ActiveRecord::Migration + def change + add_column :ci_builds, :stage_idx, :integer + end +end diff --git a/db/migrate/20151002121400_add_index_for_build_name.rb b/db/migrate/20151002121400_add_index_for_build_name.rb new file mode 100644 index 00000000000..c6a81d74661 --- /dev/null +++ b/db/migrate/20151002121400_add_index_for_build_name.rb @@ -0,0 +1,5 @@ +class AddIndexForBuildName < ActiveRecord::Migration + def up + add_index :ci_builds, [:commit_id, :stage_idx, :created_at] + end +end diff --git a/db/migrate/20151002122929_add_sha_and_ref_to_builds.rb b/db/migrate/20151002122929_add_sha_and_ref_to_builds.rb new file mode 100644 index 00000000000..fc367341f1d --- /dev/null +++ b/db/migrate/20151002122929_add_sha_and_ref_to_builds.rb @@ -0,0 +1,7 @@ +class AddShaAndRefToBuilds < ActiveRecord::Migration + def change + add_column :ci_builds, :tag, :boolean + add_column :ci_builds, :ref, :string + add_column :ci_builds, :push_data, :text + end +end diff --git a/db/migrate/20151002122943_migrate_sha_and_ref_to_build.rb b/db/migrate/20151002122943_migrate_sha_and_ref_to_build.rb new file mode 100644 index 00000000000..b80808946d8 --- /dev/null +++ b/db/migrate/20151002122943_migrate_sha_and_ref_to_build.rb @@ -0,0 +1,7 @@ +class MigrateShaAndRefToBuild < ActiveRecord::Migration + def change + execute('UPDATE ci_builds SET ref=(SELECT ref FROM ci_commits WHERE ci_commits.id = ci_builds.commit_id) WHERE ref IS NULL') + execute('UPDATE ci_builds SET push_data=(SELECT push_data FROM ci_commits WHERE ci_commits.id = ci_builds.commit_id) WHERE push_data IS NULL') + execute('UPDATE ci_builds SET tag=(SELECT tag FROM ci_commits WHERE ci_commits.id = ci_builds.commit_id) WHERE tag IS NULL') + end +end |