2016-03-27 20 views
0

我使用SequelPadrino及以下遷移提出的uninitialized constant Jsonb (NameError)錯誤:續集遷移:未初始化不斷Jsonb(NameError)

Sequel.migration do 
    up do 
    alter_table :same_table do 
     add_column :not_working, Jsonb 
    end 
    end 
end 

create_table遷移使用Jsonb沒有問題,銷售表:

Sequel.migration do 
    up do 
    create_table :same_table do 
     Jsonb :worked 
    end 
    end 
end 

回答

1

Sequel source code,列類型不應該大寫。一般來說,DSL是關於定義類方法的,而不是常量。

Sequel.migration do 
    up do 
    alter_table :same_table do 
    #       ⇓⇓ NOTE SYMBOL  
     add_column :not_working, :jsonb 
    end 
    end 
end 

Sequel.migration do 
    up do 
    create_table :same_table do 
    # ⇓ NOTE DOWNCASE 
     jsonb :worked 
    end 
    end 
end 
相關問題