Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
kidlab opened this Issue · 3 comments

2 participants

@kidlab

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

migration = Class.new(Sequel::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
    end
  end

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

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

To:

  String :value, :clob=>true

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

@jeremyevans
Owner

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
Owner

This should be fixed by d2167dc.

@kidlab

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
Something went wrong with that request. Please try again.