我试图创建具有3列URL,价格和时间戳的表...我都尝试“改变”和“向上”分贝:无法创建迁移表
class Shp < ActiveRecord::Base
def change
create_table :shps do |t|
t.string :url
t.float :price
t.timestamps
end
end
end
运行分贝:迁移似乎什么都不做,因为当我做
ActiveRecord::Base.connection.column_names("shps")
我得到一个只有默认列的表。
=> [#<ActiveRecord::ConnectionAdapters::SQLiteColumn:0x8fc8a34 @name="id", @sql_type="INTEGER", @null=false, @limit=nil, @precision=nil, @scale=nil, @type=:integer, @default=nil, @primary=nil, @coder=nil>, #<ActiveRecord::ConnectionAdapters::SQLiteColumn:0x8fc878c @name="created_at", @sql_type="datetime", @null=false, @limit=nil, @precision=nil, @scale=nil, @type=:datetime, @default=nil, @primary=nil, @coder=nil>, #<ActiveRecord::ConnectionAdapters::SQLiteColumn:0x8fc8444 @name="updated_at", @sql_type="datetime", @null=false, @limit=nil, @precision=nil, @scale=nil, @type=:datetime, @default=nil, @primary=nil, @coder=nil>]
你用“colu”方法测试mn_names“是否存在':shps'这是一个表?也许你可以通过其他工具比Ruby检查(PGAdmin3 PostGreSQL等) – MrYoshiji