rubysequelpadrino

Create text data type in sequel migration


alter_table(:pages) do add_column :about, Text end

when running the migration rake sq:migrate I get

rake aborted! NameError: uninitialized constant Text

How do i create a text data type. I did follow the docs but sequel doc has very less eg.

Update 1

I can use Text :about when creating a table in migration but the issue persist in altering table


Solution

  • You likely figured this out already, but you can specify a text data type in Sequel like so:

    alter_table(:pages) do
      add_column :about, String, text: true
    end
    

    See documentation for more details.

    This works also and is more concise:

    alter_table(:pages) do
      add_column :about, :text
    end