diff --git a/db/migrate/20161130095245_fill_routes_table.rb b/db/migrate/20161130095245_fill_routes_table.rb
index 6754e58300052bdc9165b16cace5e6c454f68e02..c3536d6d911a006d88e2a8df0377593b2a02f1bf 100644
--- a/db/migrate/20161130095245_fill_routes_table.rb
+++ b/db/migrate/20161130095245_fill_routes_table.rb
@@ -16,6 +16,6 @@ class FillRoutesTable < ActiveRecord::Migration
   end
 
   def down
-    Route.delete_all(source_type: 'Namespace')
+    execute("DELETE FROM routes WHERE source_type = 'Namespace'")
   end
 end
diff --git a/db/migrate/20161130101252_fill_projects_routes_table.rb b/db/migrate/20161130101252_fill_projects_routes_table.rb
index 14700583be55a409237e8b924e2786f429dcbaa5..4f3fe7b03a910099ed8f2f40129ae82b403072e1 100644
--- a/db/migrate/20161130101252_fill_projects_routes_table.rb
+++ b/db/migrate/20161130101252_fill_projects_routes_table.rb
@@ -17,6 +17,6 @@ class FillProjectsRoutesTable < ActiveRecord::Migration
   end
 
   def down
-    Route.delete_all(source_type: 'Project')
+    execute("DELETE FROM routes WHERE source_type = 'Project'")
   end
 end