remove indexes before renaming tables (some dbs have database-level index namespaces) and unsigned is also a mysqlism

This commit is contained in:
Andy Allan 2008-11-09 19:30:22 +00:00
parent 2aa3daf0e0
commit 4adeeb51ad
4 changed files with 10 additions and 3 deletions

View file

@ -39,7 +39,9 @@ class CleanupOsmDb < ActiveRecord::Migration
add_index "friends", ["user_id"], :name => "friends_user_id_idx"
remove_index "gps_points", :name => "points_uid_idx"
remove_index "gps_points", :name => "points_idx"
remove_column "gps_points", "user_id"
add_index "gps_points", ["latitude", "longitude"], :name => "points_idx"
change_column "gps_points", "trackid", :integer, :null => false
change_column "gps_points", "latitude", :integer, :null => false
change_column "gps_points", "longitude", :integer, :null => false

View file

@ -1,6 +1,6 @@
class TileTracepoints < ActiveRecord::Migration
def self.up
add_column "gps_points", "tile", :integer, :null => false, :unsigned => true
add_column "gps_points", "tile", :four_byte_unsigned
add_index "gps_points", ["tile"], :name => "points_tile_idx"
remove_index "gps_points", :name => "points_idx"

View file

@ -33,6 +33,8 @@ class TileNodes < ActiveRecord::Migration
end
def self.up
remove_index "current_nodes", :name => "current_nodes_timestamp_idx"
rename_table "current_nodes", "current_nodes_v5"
create_table "current_nodes", innodb_table do |t|
@ -49,12 +51,14 @@ class TileNodes < ActiveRecord::Migration
add_index "current_nodes", ["timestamp"], :name => "current_nodes_timestamp_idx"
add_index "current_nodes", ["tile"], :name => "current_nodes_tile_idx"
change_column "current_nodes", "tile", :integer, :null => false, :unsigned => true
change_column "current_nodes", "tile", :four_byte_unsigned
upgrade_table "current_nodes_v5", "current_nodes", Node
drop_table "current_nodes_v5"
remove_index "nodes", :name=> "nodes_uid_idx"
remove_index "nodes", :name=> "nodes_timestamp_idx"
rename_table "nodes", "nodes_v5"
create_table "nodes", myisam_table do |t|
@ -72,7 +76,7 @@ class TileNodes < ActiveRecord::Migration
add_index "nodes", ["timestamp"], :name => "nodes_timestamp_idx"
add_index "nodes", ["tile"], :name => "nodes_tile_idx"
change_column "nodes", "tile", :integer, :null => false, :unsigned => true
change_column "nodes", "tile", :four_byte_unsigned
upgrade_table "nodes_v5", "nodes", OldNode

View file

@ -49,6 +49,7 @@ module ActiveRecord
types[:bigint_auto_64] = { :name => "bigint(64) DEFAULT NULL auto_increment" }
types[:bigint_auto_11] = { :name => "bigint(11) DEFAULT NULL auto_increment" }
types[:bigint_auto_20] = { :name => "bigint(20) DEFAULT NULL auto_increment" }
types[:four_byte_unsigned] = { :name=> "integer unsigned NOT NULL" }
types
end