Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate in psql with new citext column throws error #644

Closed
natesholland opened this issue Apr 28, 2015 · 0 comments
Closed

migrate in psql with new citext column throws error #644

natesholland opened this issue Apr 28, 2015 · 0 comments

Comments

@natesholland
Copy link

Version of jruby: 1.7.19
Version of rails: 4.2.1
Version of postgresql: 9.4.0.1

Currently if you try to write a migration that creates a citext column it will fail in jruby with the jdbc adapter. I've tested this and it works in MRI but fails in jruby.

STR:

  • Set up a new rails app with postgresql and rails 4.2.1: rails new myapp --database=postgresql
  • Make a migration: rails g migration create_posts
  • populate it like this:
class CreatePosts < ActiveRecord::Migration
  def change
    enable_extension 'citext'
    create_table :posts do |t|
      t.string :title
      t.citext :body
      t.timestamps
    end
  end
end

Then when you run the migration (rake db:create; rake db:migrate) it throws this error:

NOTE: ActiveRecord 4.2 is not (yet) fully supported by AR-JDBC, please help us finish 4.2 support - check http://bit.ly/jruby-42 for starters
== 20150428160101 CreatePosts: migrating ======================================
-- enable_extension("citext")
   -> 0.0880s
   -> 0 rows
-- create_table(:posts)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `citext' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition:0x32ca8c9e>/Users/nateh/code/tmp/jdbc/myapp/db/migrate/20150428160101_create_posts.rb:6:in `change'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:202:in `create_table'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:662:in `method_missing'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `say_with_time'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `say_with_time'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:652:in `method_missing'
/Users/nateh/code/tmp/jdbc/myapp/db/migrate/20150428160101_create_posts.rb:4:in `change'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:606:in `exec_migration'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:590:in `migrate'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:589:in `migrate'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:588:in `migrate'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:765:in `migrate'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:995:in `execute_migration_in_transaction'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `ddl_transaction'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/transactions.rb:220:in `transaction'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `ddl_transaction'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:956:in `migrate'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `migrate'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:820:in `up'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/migration.rb:798:in `migrate'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/nateh/.rvm/gems/jruby-1.7.19/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:44:in `(root)'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
kares added a commit that referenced this issue Jun 9, 2015
@kares kares closed this as completed Jun 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants