summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-03-14 14:36:33 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-03-14 14:36:33 +0800
commit0b20d850cb964da89f8b0df3c9e78a1cc2a86e1b (patch)
tree141d582ae27df9a99b0d65859ec2cb044d2fe433 /db
parent67729cecc12a56591160d04ea5d79614b1102dc6 (diff)
downloadgitlab-ce-0b20d850cb964da89f8b0df3c9e78a1cc2a86e1b.tar.gz
Fix for postgresql
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20161201160452_migrate_project_statistics.rb4
-rw-r--r--db/migrate/20161212142807_add_lower_path_index_to_routes.rb2
-rw-r--r--db/migrate/20170130204620_add_index_to_project_authorizations.rb4
-rw-r--r--db/migrate/20170305203726_add_owner_id_foreign_key.rb6
4 files changed, 12 insertions, 4 deletions
diff --git a/db/migrate/20161201160452_migrate_project_statistics.rb b/db/migrate/20161201160452_migrate_project_statistics.rb
index 3ae3f2c159b..8386f7f9d4f 100644
--- a/db/migrate/20161201160452_migrate_project_statistics.rb
+++ b/db/migrate/20161201160452_migrate_project_statistics.rb
@@ -17,7 +17,7 @@ class MigrateProjectStatistics < ActiveRecord::Migration
end
def down
- add_column_with_default :projects, :repository_size, :float, default: 0.0
- add_column_with_default :projects, :commit_count, :integer, default: 0
+ add_column :projects, :repository_size, :float, default: 0.0
+ add_column :projects, :commit_count, :integer, default: 0
end
end
diff --git a/db/migrate/20161212142807_add_lower_path_index_to_routes.rb b/db/migrate/20161212142807_add_lower_path_index_to_routes.rb
index 6958500306f..53f4c6bbb18 100644
--- a/db/migrate/20161212142807_add_lower_path_index_to_routes.rb
+++ b/db/migrate/20161212142807_add_lower_path_index_to_routes.rb
@@ -17,6 +17,6 @@ class AddLowerPathIndexToRoutes < ActiveRecord::Migration
def down
return unless Gitlab::Database.postgresql?
- remove_index :routes, name: :index_on_routes_lower_path
+ remove_index :routes, name: :index_on_routes_lower_path if index_exists?(:routes, name: :index_on_routes_lower_path)
end
end
diff --git a/db/migrate/20170130204620_add_index_to_project_authorizations.rb b/db/migrate/20170130204620_add_index_to_project_authorizations.rb
index e9a0aee4d6a..a8c504f265a 100644
--- a/db/migrate/20170130204620_add_index_to_project_authorizations.rb
+++ b/db/migrate/20170130204620_add_index_to_project_authorizations.rb
@@ -8,4 +8,8 @@ class AddIndexToProjectAuthorizations < ActiveRecord::Migration
def up
add_concurrent_index(:project_authorizations, :project_id)
end
+
+ def down
+ remove_index(:project_authorizations, :project_id)
+ end
end
diff --git a/db/migrate/20170305203726_add_owner_id_foreign_key.rb b/db/migrate/20170305203726_add_owner_id_foreign_key.rb
index 3eece0e2eb5..5fbdc45f1a7 100644
--- a/db/migrate/20170305203726_add_owner_id_foreign_key.rb
+++ b/db/migrate/20170305203726_add_owner_id_foreign_key.rb
@@ -5,7 +5,11 @@ class AddOwnerIdForeignKey < ActiveRecord::Migration
disable_ddl_transaction!
- def change
+ def up
add_concurrent_foreign_key :ci_triggers, :users, column: :owner_id, on_delete: :cascade
end
+
+ def down
+ remove_foreign_key :ci_triggers, column: :owner_id
+ end
end