Fix rails 4 compatibility issues in migrations

This commit is contained in:
Tom Hughes 2013-08-06 23:11:31 +01:00
parent 90875bb08a
commit 95e8c63c2a
4 changed files with 8 additions and 6 deletions

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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]