openstreetmap-website/db/migrate/012_add_user_preference_id.rb
Gabriel Ebner e15fa25639 rails_port: fix migration to create a primary key with auto increment (don't
know if that will actually generate valid keys if there is already data in the
table.)
2008-05-03 14:56:43 +00:00

14 lines
541 B
Ruby

class AddUserPreferenceId < ActiveRecord::Migration
def self.up
remove_primary_key 'user_preferences'
add_column "user_preferences", "id", :bigint, :limit => 64, :null => false
add_primary_key "user_preferences", ["id"]
change_column "user_preferences", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
add_index "user_preferences", ["id"], :name => "user_preferences_id_idx"
end
def self.down
remove_index 'user_preferences', 'id'
remove_column 'user_preferences', 'id'
end
end