2016-03-27 18 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 
相关问题