Skip to content

Comments

dump_schema_information: explicitly order inserts into schema_migrations #3477

Merged
josevalim merged 1 commit intorails:masterfrom
rud:stable-migrations-version-order-rebased
Oct 31, 2011
Merged

dump_schema_information: explicitly order inserts into schema_migrations #3477
josevalim merged 1 commit intorails:masterfrom
rud:stable-migrations-version-order-rebased

Conversation

@rud
Copy link
Contributor

@rud rud commented Oct 31, 2011

dump_schema_information: now explicitly orders inserts into schema_migrations table by version value

We use active_record.schema_format = :sql as our schema dump format, and the db/development_structure.sql sees quite a bit of trivial churn in the git history due to migrations having run in different orders, as migrations are created on different feature branches over time. With this trivial fix, only added/removed migrations will create changes to the schema dump file.

The complete activerecord test suite with all database drivers pass with this change. Unfortunately, that doesn't say a big deal, as dump_schema_information is only called by the db:structure:dump rake-task. Local manual testing does confirm the change, though.

Comments on this change?

@josevalim
Copy link
Contributor

+1. I have seen this issue myself. Could you please write a test for it? Thanks!

…ons table

This change reduces churn in the db/development_structure.sql file when using :sql as
active_record.schema_format, and makes comparing diffs much easier.

Test ensures the output SQL-statements are lexically ordered by version.
@rud
Copy link
Contributor Author

rud commented Oct 31, 2011

Test added - took the liberty of updating the patch with test added. Does this also look sane to you?

josevalim added a commit that referenced this pull request Oct 31, 2011
…ased

dump_schema_information: explicitly order inserts into schema_migrations
@josevalim josevalim merged commit 2407a7a into rails:master Oct 31, 2011
@josevalim
Copy link
Contributor

Looks good, merged.

@rud
Copy link
Contributor Author

rud commented Oct 31, 2011

Awesome, thank you @josevalim :)

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.

3 participants