Skip to content

Add migration versioning via Migration subclasses - #21538

Merged
matthewd merged 8 commits into
rails:masterfrom
matthewd:migration-version
Dec 15, 2015
Merged

Add migration versioning via Migration subclasses#21538
matthewd merged 8 commits into
rails:masterfrom
matthewd:migration-version

Conversation

@matthewd

@matthewd matthewd commented Sep 8, 2015

Copy link
Copy Markdown
Member

This PR implements the migration versioning infrastructure, and restores the previous default on timestamps null: (when in 4.2-compatibility mode).

@rails-bot

Copy link
Copy Markdown

r? @chancancode

(@rails-bot has picked a reviewer for you, use r? to override)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mb use ? subclass.include Compatibility::Legacy

@matthewd
matthewd force-pushed the migration-version branch 2 times, most recently from 3916985 to 060f1ce Compare September 9, 2015 01:29
@tenderlove

Copy link
Copy Markdown
Member

LGTM. I guess the main things to point out is the difference between upgrade strategies, namely this vs this. I think the strategy in this PR is easier. But, FWIW, both PRs generate a superclass, so we can switch to the strategy pattern in #21037 at pretty much any point if we need to.

The other thing is that this PR doesn't support deriving the version from the file name. IMO the syntax proposed here is pretty unoffensive, so I'm not sure if we still want / need to derive this from the file name.

I think the main hurdle here is that we need to figure out if the filename stuff is still required.

/cc @dhh @jeremy

@dhh

dhh commented Sep 9, 2015

Copy link
Copy Markdown
Member

I'm happy enough with the superclass having the version identifier. Don't need the filename to include it too, imo. This is actually a pretty elegant solution.

@matthewd matthewd changed the title WIP: Add migration versioning via Migration subclasses Add migration versioning via Migration subclasses Dec 15, 2015
@matthewd matthewd closed this Dec 15, 2015
@matthewd matthewd reopened this Dec 15, 2015
If we use a real version, at best that'll be an onerous update required
for each release; at worst, it will encourage users to write new
migrations against an older version than they're using.

The other option would be to leave these bare, without any version
specifier. But as that's just a variant spelling of "4.2", it would seem
to raise the same concerns as above.
Apart from specific versioning support, our tests should focus on the
behaviour of whatever version they're accompanying, regardless of when
they were written.

Application code should *not* do this.
.. it also showed a deprecation warning, but we obviously needn't retain
that.
Even though this means more things to change when we bump after a
release, it's more important that our examples are directly copyable.
matthewd added a commit that referenced this pull request Dec 15, 2015
Add migration versioning via Migration subclasses
@matthewd
matthewd merged commit cd90f4f into rails:master Dec 15, 2015
@jeremy

jeremy commented Dec 15, 2015

Copy link
Copy Markdown
Member

🤘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants