summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-09-28 13:39:13 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2015-09-29 10:47:03 +0200
commitf88d9cee0fe7fc6436a14051eb20562b6b4d7d86 (patch)
treea1d41d0d917ea855c95261ef5c9db0b12c12ff72 /db
parent0e3381470870732dff69c9298131062f786d55e7 (diff)
downloadgitlab-ce-f88d9cee0fe7fc6436a14051eb20562b6b4d7d86.tar.gz
Fix migrations
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20150924125150_add_project_id_to_ci_commit.rb5
-rw-r--r--db/migrate/20150924125150_add_project_id_to_ci_tables.rb12
-rw-r--r--db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb10
-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
5 files changed, 15 insertions, 32 deletions
diff --git a/db/migrate/20150924125150_add_project_id_to_ci_commit.rb b/db/migrate/20150924125150_add_project_id_to_ci_commit.rb
new file mode 100644
index 00000000000..1a761fe0f86
--- /dev/null
+++ b/db/migrate/20150924125150_add_project_id_to_ci_commit.rb
@@ -0,0 +1,5 @@
+class AddProjectIdToCiCommit < ActiveRecord::Migration
+ def up
+ add_column :ci_commits, :gl_project_id, :integer
+ end
+end
diff --git a/db/migrate/20150924125150_add_project_id_to_ci_tables.rb b/db/migrate/20150924125150_add_project_id_to_ci_tables.rb
deleted file mode 100644
index 8b45bcf5fe1..00000000000
--- a/db/migrate/20150924125150_add_project_id_to_ci_tables.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-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_commits.rb b/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb
new file mode 100644
index 00000000000..cd449806717
--- /dev/null
+++ b/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb
@@ -0,0 +1,10 @@
+class MigrateProjectIdForCiCommits < ActiveRecord::Migration
+ def up
+ execute(
+ "UPDATE ci_commits " +
+ "JOIN ci_projects ON ci_projects.id = ci_commits.project_id " +
+ "SET gl_project_id=ci_projects.gitlab_id " +
+ "WHERE gl_project_id IS NULL"
+ )
+ 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
deleted file mode 100644
index 28d63c8c840..00000000000
--- a/db/migrate/20150924125436_migrate_project_id_for_ci_tables.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-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
deleted file mode 100644
index bb97ec30051..00000000000
--- a/db/migrate/20150924131004_add_ci_fields_to_projects_table.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddCiFieldsToProjectsTable < ActiveRecord::Migration
- def up
- add_column :projects, :shared_runners_enabled, :boolean, default: false
- end
-end