From f88d9cee0fe7fc6436a14051eb20562b6b4d7d86 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 28 Sep 2015 13:39:13 +0200 Subject: Fix migrations --- db/migrate/20150924125150_add_project_id_to_ci_commit.rb | 5 +++++ db/migrate/20150924125150_add_project_id_to_ci_tables.rb | 12 ------------ .../20150924125436_migrate_project_id_for_ci_commits.rb | 10 ++++++++++ .../20150924125436_migrate_project_id_for_ci_tables.rb | 15 --------------- .../20150924131004_add_ci_fields_to_projects_table.rb | 5 ----- 5 files changed, 15 insertions(+), 32 deletions(-) create mode 100644 db/migrate/20150924125150_add_project_id_to_ci_commit.rb delete mode 100644 db/migrate/20150924125150_add_project_id_to_ci_tables.rb create mode 100644 db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb delete mode 100644 db/migrate/20150924125436_migrate_project_id_for_ci_tables.rb delete mode 100644 db/migrate/20150924131004_add_ci_fields_to_projects_table.rb (limited to 'db') 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 -- cgit v1.2.3