【发布时间】:2013-01-23 05:01:55
【问题描述】:
我在迁移过程中遇到了基本的导轨问题。这是两个脚本
class CreateGoogleMaps < ActiveRecord::Migration
def self.up
create_table :google_maps do |t|
t.string :name, :null => false
t.string :description
t.column "center", :point, :null => false, :srid => 4326, :with_z => false # 4326: WSG84
t.integer :zoom
t.datetime :created_at
t.datetime :updated_at
t.integer :created_by_id
t.integer :updated_by_id
end
end
def self.down
drop_table :google_maps
end
end
文件 #2 +++ 003_add_map_style.rb ++++++
class AddMapStyle < ActiveRecord::Migration
def self.up
add_column :google_maps, :style, :integer
GoogleMaps.update_all( "style = 1")
end
def self.down
remove_column :google_maps, :style
end
end
***********************************************
这是我在迁移过程中看到的 == CreateGoogleMaps:迁移 ============================================== == -- create_table(:google_maps) -> 0.0638s == CreateGoogleMaps: 迁移 (0.0640s) =====================================
== CreateMarkers:迁移 =========================================== ======== -- create_table(:markers) -> 0.0537 秒 == CreateMarkers:迁移(0.0539s)========================================
== AddMapStyle:迁移 =========================================== ========== -- add_column(:google_maps, :style, :integer) -> 0.0406s 耙中止! 发生错误,所有后续迁移均已取消:
未初始化的常量 AddMapStyle::GoogleMaps
我使用的是 Rails 2.3.11。非常感谢任何调试提示!
【问题讨论】: