Sequel::Migration String :text=>true does not work with Oracle XE #555

kidlab opened this Issue Sep 24, 2012 · 3 comments


None yet
2 participants

kidlab commented Sep 24, 2012

I have some schema migrations that work fine with most of DB adapters except for Oracle XE.
Here is a Sequel migration class:

migration = do
  def up
    create_table("settings") do
      primary_key :id
      String :name, :size=>255, :null=>false
      String :value, :text=>true
      String :format, :size=>255
      DateTime :created_at, :null=>false
      DateTime :updated_at, :null=>false

  def down
    drop_table("settings") if @db.table_exists?("settings")

oracle = Sequel.connect(:adapter => 'oracle', :host => 'localhost', :port => 1521, :database => 'xe', :user => 'user', :password => 'password')
migration.apply(oracle, :up)

Then it will raise an exception:

Sequel::DatabaseError: NativeException: ORA-00902: invalid datatype

To make it run I have to change the line:

  String :value, :text=>true


  String :value, :clob=>true

Then it works with Oracle, but it can't work with other DB adapters anymore!


jeremyevans commented Sep 24, 2012

Looking at the specs, we don't have a spec for String :text=>true, so I guess it isn't surprising that it doesn't work on all adapters. I'll add a spec for it and see what other databases have the same problem. The fix is just using a type supported by the database (probably clob for oracle).


jeremyevans commented Sep 24, 2012

This should be fixed by d2167dc.

kidlab commented Sep 25, 2012

Thank you a lot!. It works fine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment