Skip to content

Commit 1100eb0

Browse files
author
Robert Speicher
committed
Merge branch 'make-migrations-reversible' into 'master'
Make migrations reversible See merge request !2191
2 parents 9f69a0b + 89aed37 commit 1100eb0

7 files changed

+12
-5
lines changed

db/migrate/20151203162134_add_build_events_to_services.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class AddBuildEventsToServices < ActiveRecord::Migration
2-
def up
2+
def change
33
add_column :services, :build_events, :boolean, default: false, null: false
44
add_column :web_hooks, :build_events, :boolean, default: false, null: false
55
end

db/migrate/20151209144329_migrate_ci_web_hooks.rb

+3
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ def up
1010
'JOIN projects ON ci_projects.gitlab_id = projects.id'
1111
)
1212
end
13+
14+
def down
15+
end
1316
end

db/migrate/20151210125928_add_ci_to_project.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class AddCiToProject < ActiveRecord::Migration
2-
def up
2+
def change
33
add_column :projects, :ci_id, :integer
44
add_column :projects, :builds_enabled, :boolean, default: true, null: false
55
add_column :projects, :shared_runners_enabled, :boolean, default: true, null: false

db/migrate/20151210125929_add_project_id_to_ci.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class AddProjectIdToCi < ActiveRecord::Migration
2-
def up
2+
def change
33
add_column :ci_builds, :gl_project_id, :integer
44
add_column :ci_runner_projects, :gl_project_id, :integer
55
add_column :ci_triggers, :gl_project_id, :integer

db/migrate/20151210125930_migrate_ci_to_project.rb

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ def up
1414
migrate_ci_service
1515
end
1616

17+
def down
18+
# We can't reverse the data
19+
end
20+
1721
def migrate_project_id_for_table(table)
1822
subquery = "SELECT gitlab_id FROM ci_projects WHERE ci_projects.id = #{table}.project_id"
1923
execute("UPDATE #{table} SET gl_project_id=(#{subquery}) WHERE gl_project_id IS NULL")

db/migrate/20151210125931_add_index_to_ci_tables.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class AddIndexToCiTables < ActiveRecord::Migration
2-
def up
2+
def change
33
add_index :ci_builds, :gl_project_id
44
add_index :ci_runner_projects, :gl_project_id
55
add_index :ci_triggers, :gl_project_id

db/migrate/20151210125932_drop_null_for_ci_tables.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class DropNullForCiTables < ActiveRecord::Migration
2-
def up
2+
def change
33
remove_index :ci_variables, :project_id
44
remove_index :ci_runner_projects, :project_id
55
change_column_null :ci_triggers, :project_id, true

0 commit comments

Comments
 (0)