Question

how can i set a custom seq name in migration file?

we use a firebird db with jdbc adapter. in firebird, the column size is limit by 32. so the error msg is: Name longer than database column size

we had the same problem with index, but there you can set a custom name:

add_index :table_name, :column, :name => "custom_name_index"
Was it helpful?

Solution

Seems that firebird driver https://github.com/jruby/activerecord-jdbc-adapter/blob/master/lib/arjdbc/firebird/adapter.rb

needs patching like in the oracle case https://github.com/jruby/activerecord-jdbc-adapter/blob/master/lib/arjdbc/oracle/adapter.rb

IDENTIFIER_LENGTH = 31
def default_sequence_name(table_name, column = nil)
  "#{table_name.to_s[0, IDENTIFIER_LENGTH - 4]}_seq"
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top