I'm usingRails 3.2.13 and schema_plus 1.1.2 . The following migration does'nt work:
class AddResourceToFileAssets < ActiveRecord::Migration
def up
change_table :file_assets do |t|
t.references :resource, :polymorphic => true
end
end
def down
end
end
schema_plus tries to create a foreign key pointing to a non-existent table:
== AddResourceToFileAssets: migrating ========================================
-- change_table(:file_assets)
rake aborted!
An error has occurred, all later migrations canceled:
Mysql2::Error: Can't create table 'v2p0_development.#sql-70e_360' (errno: 150): ALTER TABLE `file_assets` ADD CONSTRAINT fk_file_assets_resource_id FOREIGN KEY (`resource_id`) REFERENCES `resources` (`id`)/usr/local/rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `query'
/
This seems to be a bug. Note that the same syntax works correctly with create_table, it was fixed in 0.4.1.
I'm usingRails 3.2.13 and schema_plus 1.1.2 . The following migration does'nt work:
schema_plus tries to create a foreign key pointing to a non-existent table:
This seems to be a bug. Note that the same syntax works correctly with create_table, it was fixed in 0.4.1.