Closed Smarre closed 9 years ago
This feature is already supported, albeit implicitly. I've added tests to ensure support will remain.
It didn’t work for me though, I didn’t get a comment in my column, with MySQL...
Strange... I just tested it with MySQL and it seemed to work properly. Can you create a test case that demonstrates this?
Okay, by any chance, did you use trunk version? I assume you did.
Looks like Activerecord 4 support has been committed after it, I’m using stable version of 0.3.2, maybe that is the problem... I’ll test with trunk version.
Nope, still not working, with current trunk. What kind of test would you like for this? I don’t really know how to do simple test for Activerecord (my environment is based to still unreleased/closed source so I can’t provide the gem I’m using for it, so I need to create different kind of system to run the migration for just the test).
Please see https://github.com/pinnymz/migration_comments/blob/master/test/add_comments_test.rb#L29 for an example. It may also be helpful to see a list of gems you are using, as it's possible there's some incompatibility somewhere.
Hello, I HAD the same issue. But then I found out that I didn't install gem migration_comments
in my project correctly. That's why my migration failed with error: undefined method
set_column_comment ...`.
After correct installation the following migrations worked for me:
class AddCurrentActivityDatesToCompanies < ActiveRecord::Migration
def self.up
add_column :companies, :current_activity_starts_on, :date, comment: 'Comment 1'
set_column_comment :companies, :current_activity_ends_on, 'Comment 2'
# ...
end
# ...
end
So, this gem works correctly in my environment: Ruby: 1.9.3-p547, Rails: 3.2.22, PostgreSQL: 9.2.13, Bundler: 1.7.9.
@yesnik glad to hear that you can confirm this. I'm closing the issue for now.
Hi,
I have a feature request: I don’t know if this should be supported (documentation doesn’t say so I assume no), but syntax like
should be supported. At the moment, after adding new column, it would be needed to call
set_new_comment
after adding the new column, resulting to duplicating some information.