来自ActiveRecord的示例:
使用相关表:
def change
create_table :users do |i|
i.text :name
end
create_table :thingies do |i|
i.integer :thingie
i.text :discription
end
end
class User < ActiveRecord::Base
has_many :thingies
end
class Thingie < ActiveRecord::Base
belongs_to :user
end
使用嵌入式数据结构(多维数组)方法:
def change
create_table :users do |i|
i.text :name
i.text :thingies, array: true # example contents: [[thingie,discription],[thingie,discription]]
end
end
class User < ActiveRecord::Base
end
相关信息
我正在使用Heroku和Heroku-Postgres作为我的数据库。我正在使用它们的免费选项,限制了我只能使用10,000行数据。这似乎让我想使用多维数组方式,但我并不真正了解。