Skip to content
Snippets Groups Projects
Commit f88d9cee authored by Kamil Trzcińśki's avatar Kamil Trzcińśki
Browse files

Fix migrations

parent 0e338147
No related branches found
No related tags found
No related merge requests found
class AddProjectIdToCiCommit < ActiveRecord::Migration
def up
add_column :ci_commits, :gl_project_id, :integer
end
end
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
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
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
class AddCiFieldsToProjectsTable < ActiveRecord::Migration
def up
add_column :projects, :shared_runners_enabled, :boolean, default: false
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment