rsim / oracle-enhanced

Oracle enhaced adapter for ActiveRecord
MIT License
549 stars 310 forks source link

Newly created database error when running migrations "DESC schema_migrations" failed; does it exist? #1939

Closed coreypmurphy closed 5 years ago

coreypmurphy commented 5 years ago

Steps to reproduce

1) rails new my_app 2) add oracle-enhanced & ruby-oci8 to gemfile 3) bundle 4) configure database.yml 5) rails active_storage:install 6) rake db:migrate

Expected behavior

Migration should create table 2 tables

Actual behavior

Migration fails to create 2 tables

System configuration

Rails version: 6.0.0 Ruby version: 2.6.3 Oracle enhanced adapter version: 6.0.0 ruby-oci8 version: 2.2.7 Oracle Database version:

STACK TRACE:

ActiveRecord::ConnectionAdapters::OracleEnhanced::ConnectionException: "DESC schema_migrations" failed; does it exist?
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-oracle_enhanced-adapter-6.0.0/lib/active_record/connection_adapters/oracle_enhanced/connection.rb:66:in `describe'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-oracle_enhanced-adapter-6.0.0/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:225:in `describe'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-oracle_enhanced-adapter-6.0.0/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:535:in `column_definitions'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `columns'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-oracle_enhanced-adapter-6.0.0/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb:165:in `columns'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/schema_cache.rb:76:in `columns'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/schema_cache.rb:82:in `columns_hash'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/model_schema.rb:487:in `load_schema!'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/attributes.rb:247:in `load_schema!'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/attribute_decorators.rb:51:in `load_schema!'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/model_schema.rb:480:in `block in load_schema'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/model_schema.rb:477:in `load_schema'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/model_schema.rb:352:in `columns_hash'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/inheritance.rb:82:in `descends_from_active_record?'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/inheritance.rb:88:in `finder_needs_type_condition?'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/core.rb:298:in `relation'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/scoping/named.rb:56:in `default_scoped'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/scoping/named.rb:44:in `all'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/querying.rb:21:in `order'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/schema_migration.rb:52:in `all_versions'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/migration.rb:1260:in `load_migrated'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/migration.rb:1256:in `migrated'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/migration.rb:1296:in `ran?'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/migration.rb:1238:in `block in runnable'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/migration.rb:1238:in `reject'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/migration.rb:1238:in `runnable'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/migration.rb:1281:in `migrate_without_lock'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/migration.rb:1231:in `migrate'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/migration.rb:1061:in `up'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/migration.rb:1036:in `migrate'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/railties/databases.rake:85:in `block (3 levels) in <main>'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/railties/databases.rake:83:in `each'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/railties/databases.rake:83:in `block (2 levels) in <main>'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
/Users/coreymurphy/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'

MIGRATION:

class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
  def change
    create_table :active_storage_attachments do |t|
      t.string     :name,     null: false
      t.references :record,   null: false, polymorphic: true, index: false
      t.references :blob,     null: false
      t.datetime :created_at, null: false
      t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
      t.foreign_key :active_storage_blobs, column: :blob_id
    end

    create_table :active_storage_blobs do |t|
      t.string   :key,        null: false
      t.string   :filename,   null: false
      t.string   :content_type
      t.text     :metadata
      t.bigint   :byte_size,  null: false
      t.string   :checksum,   null: false
      t.datetime :created_at, null: false
      t.index [ :key ], unique: true
    end
  end
end
coreypmurphy commented 5 years ago

In opting to try a different approach and just use "rake db:schema:load" instead, the error has changed so I'll close this one and open a different one.