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

Warn when ALTERing without PtOscMigration #9

Merged
merged 5 commits into from
Mar 9, 2015
Merged

Conversation

steverice
Copy link
Collaborator

If an ALTER command is being called on the MysqlPtOscAdapter without coming from a PtOscMigration, this usually means that commands will be queued up in the commands hash and never actually executed. This results in silent failure.

To make this failure more apparent, issue a warning when add_command is called and PtOscMigration does not appear in the stack trace.

@steverice steverice force-pushed the migration-warning branch 3 times, most recently from d400f5f to 875df0d Compare March 8, 2015 01:54
This will allow them to be used in other tests.
If an ALTER command is being called on the MysqlPtOscAdapter without coming from a PtOscMigration, this usually means that commands will be queued up in the commands hash and never actually executed. This results in silent failure.

To make this failure more apparent, issue a warning when add_command is called and PtOscMigration does not appear in the stack trace.
Some names — primarily "id" — have special meaning to Rails. To be safe, just choose predefined strings instead of using Faker.
Prior to 4.1.0, when Railties loaded rake tasks it would set verbosity to nil:
TylerRick/rails@9affba8

Since we want the warning about not using PtOscMigration to be displayed, explicitly enable warnings for older versions of Rails.
Update CHANGELOG
steverice added a commit that referenced this pull request Mar 9, 2015
Warn when ALTERing without PtOscMigration
@steverice steverice merged commit 2ffd539 into master Mar 9, 2015
@steverice steverice deleted the migration-warning branch March 9, 2015 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant