我正在尝试创建一个包含 3 列 url、价格和时间戳的表...我尝试了“更改”和“向上”
class Shp < ActiveRecord::Base
def change
create_table :shps do |t|
t.string :url
t.float :price
t.timestamps
end
end
end
运行 db:migrate 似乎什么都不做,就像我做的那样
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>]