代码之家  ›  专栏  ›  技术社区  ›  agentofuser

如何在hobofelds中定义数据库索引?

  •  1
  • agentofuser  · 技术社区  · 16 年前

    HoboFields ,我可以在自己的文件中声明模型的字段,如下所示:

    class User < ActiveRecord::Base
    
      fields do
        login :string
        persistence_token :string
      end
    
    end
    

    我想知道 add_index 我可以在普通的Rails迁移中使用这个命令。

    2 回复  |  直到 15 年前
        1
  •  1
  •   Ken Melton    15 年前
    class User < ActiveRecord::Base 
    
      fields do 
        login :string 
        persistence_token :string, :index => true
      end 
    
    end 
    
        2
  •  0
  •   agentofuser    16 年前

    这在霍伯菲尔德还不存在,但我已经建议了 this thread 它似乎将在未来的版本中实现。

    编辑:它已经实现,目前在这个实验分支中: http://github.com/tablatom/hobo/tree/indexgen . 当答案包含在一个版本中时,我会更新它。