summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-09-24 17:09:33 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2015-09-29 10:47:03 +0200
commit1530f68c9876bc8376bf4aa199c8abda570f5214 (patch)
tree025a0ff29e9c886a866d0e5c3362947257f75480 /db/migrate
parente1b7fcedfb24353c857a160cd0c981f02fb2542a (diff)
downloadgitlab-ce-1530f68c9876bc8376bf4aa199c8abda570f5214.tar.gz
WIP
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20150924125150_add_project_id_to_ci_tables.rb12
-rw-r--r--db/migrate/20150924125436_migrate_project_id_for_ci_tables.rb15
-rw-r--r--db/migrate/20150924131004_add_ci_fields_to_projects_table.rb5
3 files changed, 32 insertions, 0 deletions
diff --git a/db/migrate/20150924125150_add_project_id_to_ci_tables.rb b/db/migrate/20150924125150_add_project_id_to_ci_tables.rb
new file mode 100644
index 00000000000..8b45bcf5fe1
--- /dev/null
+++ b/db/migrate/20150924125150_add_project_id_to_ci_tables.rb
@@ -0,0 +1,12 @@
+class AddProjectIdToCiTables < ActiveRecord::Migration
+ def up
+ add_column :ci_builds, :gl_project_id, :integer
+ add_column :ci_commits, :gl_project_id, :integer
+ add_column :ci_events, :gl_project_id, :integer
+ add_column :ci_runner_projects, :gl_project_id, :integer
+ add_column :ci_services, :gl_project_id, :integer
+ add_column :ci_triggers, :gl_project_id, :integer
+ add_column :ci_variables, :gl_project_id, :integer
+ add_column :ci_web_hooks, :gl_project_id, :integer
+ end
+end
diff --git a/db/migrate/20150924125436_migrate_project_id_for_ci_tables.rb b/db/migrate/20150924125436_migrate_project_id_for_ci_tables.rb
new file mode 100644
index 00000000000..28d63c8c840
--- /dev/null
+++ b/db/migrate/20150924125436_migrate_project_id_for_ci_tables.rb
@@ -0,0 +1,15 @@
+class MigrateProjectIdForCiTables < ActiveRecord::Migration
+ TABLES = %w(ci_builds ci_commits ci_events ci_runner_projects
+ ci_services ci_triggers ci_variables ci_web_hooks)
+
+ def up
+ TABLES.each do |table|
+ execute(
+ "UPDATE #{table} " +
+ "JOIN ci_projects ON ci_projects.id = #{table}.project_id " +
+ "SET gl_project_id=ci_projects.gitlab_id " +
+ "WHERE gl_project_id IS NULL"
+ )
+ end
+ end
+end
diff --git a/db/migrate/20150924131004_add_ci_fields_to_projects_table.rb b/db/migrate/20150924131004_add_ci_fields_to_projects_table.rb
new file mode 100644
index 00000000000..bb97ec30051
--- /dev/null
+++ b/db/migrate/20150924131004_add_ci_fields_to_projects_table.rb
@@ -0,0 +1,5 @@
+class AddCiFieldsToProjectsTable < ActiveRecord::Migration
+ def up
+ add_column :projects, :shared_runners_enabled, :boolean, default: false
+ end
+end