From 8cdd54cc0696b76daa2baf463d02d944b50bac6a Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Thu, 10 Dec 2015 17:29:44 +0100 Subject: Add runners token --- db/migrate/20151203162135_add_ci_to_project.rb | 3 ++- db/migrate/20151204110613_migrate_ci_to_project.rb | 7 ++++--- db/migrate/20151204110832_add_index_to_ci_tables.rb | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'db/migrate') diff --git a/db/migrate/20151203162135_add_ci_to_project.rb b/db/migrate/20151203162135_add_ci_to_project.rb index e95942666c3..8a65abab636 100644 --- a/db/migrate/20151203162135_add_ci_to_project.rb +++ b/db/migrate/20151203162135_add_ci_to_project.rb @@ -1,8 +1,9 @@ class AddCiToProject < ActiveRecord::Migration def up + add_column :projects, :ci_id, :integer add_column :projects, :builds_enabled, :boolean, default: true, null: false add_column :projects, :shared_runners_enabled, :boolean, default: true, null: false - add_column :projects, :token, :string + add_column :projects, :runners_token, :string add_column :projects, :build_coverage_regex, :string add_column :projects, :build_allow_git_fetch, :boolean, default: true, null: false add_column :projects, :build_timeout, :integer, default: 3600, null: false diff --git a/db/migrate/20151204110613_migrate_ci_to_project.rb b/db/migrate/20151204110613_migrate_ci_to_project.rb index 1777b6170b4..d17b2a425f8 100644 --- a/db/migrate/20151204110613_migrate_ci_to_project.rb +++ b/db/migrate/20151204110613_migrate_ci_to_project.rb @@ -5,8 +5,9 @@ class MigrateCiToProject < ActiveRecord::Migration migrate_project_id_for_table('ci_variables') migrate_project_id_for_builds - migrate_project_column('shared_runners_enabled') - migrate_project_column('token') + migrate_project_column('id', 'ci_id') + migrate_project_column('shared_runners_enabled', 'shared_runners_enabled') + migrate_project_column('token', 'runners_token') migrate_project_column('coverage_regex', 'build_coverage_regex') migrate_project_column('allow_git_fetch', 'build_allow_git_fetch') migrate_project_column('timeout', 'build_timeout') @@ -25,7 +26,7 @@ class MigrateCiToProject < ActiveRecord::Migration def migrate_project_column(column, new_column = nil) new_column ||= column - subquery = "SELECT #{column} FROM ci_projects WHERE projects.id = ci_projects.gitlab_id" + subquery = "SELECT ci_projects.#{column} FROM ci_projects WHERE projects.id = ci_projects.gitlab_id" execute("UPDATE projects SET #{new_column}=(#{subquery}) WHERE #{new_column} IS NULL AND (#{subquery}) IS NOT NULL") end diff --git a/db/migrate/20151204110832_add_index_to_ci_tables.rb b/db/migrate/20151204110832_add_index_to_ci_tables.rb index b95931334c6..9fedb5d612c 100644 --- a/db/migrate/20151204110832_add_index_to_ci_tables.rb +++ b/db/migrate/20151204110832_add_index_to_ci_tables.rb @@ -4,8 +4,9 @@ class AddIndexToCiTables < ActiveRecord::Migration add_index :ci_runner_projects, :gl_project_id add_index :ci_triggers, :gl_project_id add_index :ci_variables, :gl_project_id - add_index :projects, :token + add_index :projects, :runners_token add_index :projects, :builds_enabled add_index :projects, [:builds_enabled, :shared_runners_enabled] + add_index :projects, [:ci_id] end end -- cgit v1.2.3