Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Incompatible with MigrationComments #170

Open
dmeranda opened this issue Sep 9, 2014 · 3 comments
Open

Incompatible with MigrationComments #170

dmeranda opened this issue Sep 9, 2014 · 3 comments

Comments

@dmeranda
Copy link

dmeranda commented Sep 9, 2014

I'm not sure if this is a bug with schema_plus, or with migration_comments, but the two gems do not cooperate when rules from each are used on the same column. If this is a bug in the other gem I can re-post the issue there; but there seem to be more eyeballs here. See https://github.com/pinnymz/migration_comments

An example:

create_table "table_a" do |t|
  t.integer :something_id, :references => nil, :comment => 'Foo bar'
end

The :references option does not seem to be processed by schema_plus when there is also a :comment option, which causes schema_plus to attempt to create a default foreign key when it should not.

Using:

  • schema_plus 1.5.3 (latest)
  • migration_comments 0.3.2 (latest)
  • Rails ActiveRecord 3.2.16
  • MySQL
@dmeranda
Copy link
Author

dmeranda commented Sep 9, 2014

I also reported this issue over on the migration_comments project.

See pinnymz/migration_comments#19

@lowjoel
Copy link
Member

lowjoel commented Oct 12, 2015

cc @ronen, re SchemaPlus/schema_monkey#6

@ronen
Copy link
Member

ronen commented Oct 12, 2015

@dmeranda unfortunately, as per the discussion in SchemaPlus/schema_monkey#6 and pinnymz/migration_comments#19, it's not so much a bug in either schema_plus or migration_comments, but rather an incompatibility due to different implementation methodologies.

TL;dr: migration_comments uses include and alias_method_chain, which was the only game in town prior to ruby 2.0. Whereas schema_plus uses prepend and super, which is generally considered the better approach, but doesn't exist on ruby 1.9. And unfortunately using them at the same time leads to inconsistent results or infinite recursion.

The only solution that I know of would be for migration_comments to "upgrade" to the new methodology or schema_plus to "downgrade".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants