summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-12-10 17:29:44 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2015-12-11 18:02:09 +0100
commit8cdd54cc0696b76daa2baf463d02d944b50bac6a (patch)
treeeb3e5c1aeef92181b49217c965685e5b9ba67c74 /db
parente80e3f5372d6bcad1fbe04a85b3086bb66794828 (diff)
downloadgitlab-ce-8cdd54cc0696b76daa2baf463d02d944b50bac6a.tar.gz
Add runners token
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20151203162135_add_ci_to_project.rb3
-rw-r--r--db/migrate/20151204110613_migrate_ci_to_project.rb7
-rw-r--r--db/migrate/20151204110832_add_index_to_ci_tables.rb3
3 files changed, 8 insertions, 5 deletions
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