-
Notifications
You must be signed in to change notification settings - Fork 190
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
Make the primary key to use for the migration configurable #73
Conversation
Nice work @ags, hopefully this gets merged soon. |
fcac683
to
b84952d
Compare
@ags thanks for the PR, do you mind rebasing this against latest master and add a changelog entry for it? |
23851b8
to
bcae636
Compare
bcae636
to
91a6468
Compare
91a6468
to
d373e71
Compare
633ec01
to
be8004d
Compare
be8004d
to
4b235e4
Compare
4b235e4
to
288a4a5
Compare
288a4a5
to
efb5e37
Compare
Instead of relying on a table to have a primary key, we now accept the order_column option and put that everywhere. This kind of uncomfortable state about the migration now needs to be given to everyone and I think an appropriate place is the migration, since most objects in the system have access to it and they all need to agree on the value. This required passing the options down a couple more objects for the Migrator creating the Migration to have access, but I think thats acceptable for this increase in functionality.
efb5e37
to
bc819f2
Compare
Sorry for the bump, but any idea if/when this will be merged? Thanks! |
@@ -188,7 +189,11 @@ def validate | |||
end | |||
|
|||
unless @origin.satisfies_id_autoincrement_requirement? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no way for this to not error out when an order_column
is specified.
@origin.satisfies_id_autoincrement_requirement?
checks the id
column, even if an order_column
is set. Once that check fails, an error is set no matter what. The code should probably look more like:
if @options[:order_column]
if !@origin.can_use_order_column?(@options[:order_column])
error("origin does not satisfy primary key requirements")
end
else
if !@origin.satisfies_id_autoincrement_requirement?
error("origin does not satisfy primary key requirements")
end
end
Sorry for the comment, not sure what the best way to submit changes to a PR is. Thanks!
This a squashed and rebased version of #49, since @airhorns seems unreachable.
There were a few conflicts, which I've resolved. It'd be great if we can get this looked at again!
#49