Make the tile ID column unsigned as intended.
This commit is contained in:
parent
f67fae73ce
commit
62dfa5ff45
2 changed files with 9 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
class TileTracepoints < ActiveRecord::Migration
|
class TileTracepoints < ActiveRecord::Migration
|
||||||
def self.up
|
def self.up
|
||||||
add_column "gps_points", "tile", :integer, :null => false, :options => "UNSIGNED"
|
add_column "gps_points", "tile", :integer, :null => false, :unsigned => true
|
||||||
add_index "gps_points", ["tile"], :name => "points_tile_idx"
|
add_index "gps_points", ["tile"], :name => "points_tile_idx"
|
||||||
remove_index "gps_points", :name => "points_idx"
|
remove_index "gps_points", :name => "points_idx"
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,14 @@ module ActiveRecord
|
||||||
return false if options[:options] =~ /AUTO_INCREMENT/i
|
return false if options[:options] =~ /AUTO_INCREMENT/i
|
||||||
return old_options_include_default?(options)
|
return old_options_include_default?(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method :old_add_column_options!, :add_column_options!
|
||||||
|
|
||||||
|
def add_column_options!(sql, options)
|
||||||
|
sql << " UNSIGNED" if options[:unsigned]
|
||||||
|
old_add_column_options!(sql, options)
|
||||||
|
sql << " #{options[:options]}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class MysqlAdapter
|
class MysqlAdapter
|
||||||
|
@ -40,7 +48,6 @@ module ActiveRecord
|
||||||
|
|
||||||
change_column_sql = "ALTER TABLE #{table_name} CHANGE #{column_name} #{column_name} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"
|
change_column_sql = "ALTER TABLE #{table_name} CHANGE #{column_name} #{column_name} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"
|
||||||
add_column_options!(change_column_sql, options)
|
add_column_options!(change_column_sql, options)
|
||||||
change_column_sql << " #{options[:options]}"
|
|
||||||
execute(change_column_sql)
|
execute(change_column_sql)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue