From: Tom Hughes Date: Tue, 6 Aug 2013 22:11:31 +0000 (+0100) Subject: Fix rails 4 compatibility issues in migrations X-Git-Tag: live~4767 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/95e8c63c2a3aee63c3eb21d7b70343ff1d17f652 Fix rails 4 compatibility issues in migrations --- diff --git a/db/migrate/001_create_osm_db.rb b/db/migrate/001_create_osm_db.rb index 8ddc68bcd..d952c0a07 100644 --- a/db/migrate/001_create_osm_db.rb +++ b/db/migrate/001_create_osm_db.rb @@ -78,11 +78,11 @@ class CreateOsmDb < ActiveRecord::Migration create_table "gps_points", myisam_table do |t| t.column "altitude", :float - t.column "user_id", :integer, :limit => 20 + t.column "user_id", :integer t.column "trackid", :integer t.column "latitude", :integer t.column "longitude", :integer - t.column "gpx_id", :integer, :limit => 20 + t.column "gpx_id", :integer t.column "timestamp", :datetime end diff --git a/db/migrate/031_create_countries.rb b/db/migrate/031_create_countries.rb index cc0627cd2..337e86fde 100644 --- a/db/migrate/031_create_countries.rb +++ b/db/migrate/031_create_countries.rb @@ -24,11 +24,11 @@ class CreateCountries < ActiveRecord::Migration maxlon = ele.get_text("bBoxEast").to_s maxlat = ele.get_text("bBoxNorth").to_s - Country.create({ + Country.create( :code => code, :min_lat => minlat.to_f, :max_lat => maxlat.to_f, :min_lon => minlon.to_f, :max_lon => maxlon.to_f - }, :without_protection => true) + ) end end end diff --git a/db/migrate/053_add_map_bug_tables.rb b/db/migrate/053_add_map_bug_tables.rb index b3a1acee6..6851a20b4 100644 --- a/db/migrate/053_add_map_bug_tables.rb +++ b/db/migrate/053_add_map_bug_tables.rb @@ -5,7 +5,6 @@ class AddMapBugTables < ActiveRecord::Migration create_enumeration :map_bug_status_enum, ["open", "closed", "hidden"] create_table :map_bugs do |t| - t.column :id, :bigint, :null => false t.integer :latitude, :null => false t.integer :longitude, :null => false t.column :tile, :bigint, :null => false @@ -16,6 +15,8 @@ class AddMapBugTables < ActiveRecord::Migration t.column :status, :map_bug_status_enum, :null => false end + change_column :map_bugs, :id, :bigint + add_index :map_bugs, [:tile, :status], :name => "map_bugs_tile_idx" add_index :map_bugs, [:last_changed], :name => "map_bugs_changed_idx" add_index :map_bugs, [:date_created], :name => "map_bugs_created_idx" diff --git a/db/migrate/054_refactor_map_bug_tables.rb b/db/migrate/054_refactor_map_bug_tables.rb index b094cc593..d94105035 100644 --- a/db/migrate/054_refactor_map_bug_tables.rb +++ b/db/migrate/054_refactor_map_bug_tables.rb @@ -3,7 +3,6 @@ require 'migrate' class RefactorMapBugTables < ActiveRecord::Migration def self.up create_table :map_bug_comment do |t| - t.column :id, :bigint, :null => false t.column :bug_id, :bigint, :null => false t.boolean :visible, :null => false t.datetime :date_created, :null => false @@ -15,6 +14,8 @@ class RefactorMapBugTables < ActiveRecord::Migration remove_column :map_bugs, :text + change_column :map_bug_comment, :id, :bigint + add_index :map_bug_comment, [:bug_id], :name => "map_bug_comment_id_idx" add_foreign_key :map_bug_comment, [:bug_id], :map_bugs, [:id]