0

I'm using Sequel with Padrino and the following migration raised the uninitialized constant Jsonb (NameError) error:

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

The create_table migration for the sale table used Jsonb without issue:

Sequel.migration do
  up do
    create_table :same_table do
      Jsonb :worked
    end
  end
end
vladiim
  • 1,862
  • 2
  • 20
  • 27

1 Answers1

2

As by Sequel source code, the column type should not be capitalized. In general, DSL is about defining class methods, not constants.

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
Aleksei Matiushkin
  • 119,336
  • 10
  • 100
  • 160