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

Add support for :binary_id Ecto primary key type #156

Merged
merged 1 commit into from
Aug 6, 2023

Conversation

whatyouhide
Copy link
Contributor

@whatyouhide whatyouhide commented May 25, 2023

My awesome coworker @vinniefranco made these changes a while ago: vinniefranco@b432c4e

I updated the README and thought maybe this could make it upstream, and eventually be released 🙃 We've been using this code in production for a good while now. The value could also be Ecto.UUID, for example.

@whatyouhide
Copy link
Contributor Author

Btw, this is a revival of #129.

@whatyouhide
Copy link
Contributor Author

@tompave hiya! Any chance you had some time to get some 👀 on this? 🙃

@tylerbarker
Copy link
Contributor

Hey @whatyouhide , I've had a PR up here for quite some time so until @tompave returns I've created a Hex published fork. You're welcome to raise your pull request there and I'll check it out 🙂

@whatyouhide
Copy link
Contributor Author

@tylerbarker thanks for reaching out, fork_with_flags looks good. I reached out to @tompave on a few platforms, let's see if they get back to me, otherwise yes, we'll consider switching to the fork 🙃

Copy link
Owner

@tompave tompave left a comment

Choose a reason for hiding this comment

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

Thank you for the PR, and apologies for the long wait.

This should work. Compared to the original PR that you based this on, this relies on Application.compile_env/3 which should make it ok.

I think that the DB migration should also change, though. It cannot be bigserial in this case.

Documenting it should be enough I reckon. Can you please:

  1. Explain that the migration needs to be updated in the readme. Add a h4 section right after "Ecto Multi-tenancy", titled "Ecto custom PK types", or something like that. Move the example that you currently have in the Readme diff to that section, and explain that in order for it to work the DB migration must also be updated (please provide an example for that specific line).
  2. In the migration file, please add a comment with an alternative line for the PK, so that users adopting the package for the first time can easily modify it.
  3. I pushed some CI and mix.lock updates to master. Please merge that in, in order to run CI on the latest.

README.md Outdated Show resolved Hide resolved
@whatyouhide
Copy link
Contributor Author

whatyouhide commented Jul 26, 2023

@tompave I did all the stuff you mentioned 🙃, pushed just now.

@tompave
Copy link
Owner

tompave commented Aug 6, 2023

Thank you @whatyouhide. I'll get this moving forward this week.

@tompave tompave merged commit 068e5fe into tompave:master Aug 6, 2023
9 checks passed
@whatyouhide
Copy link
Contributor Author

@tompave okay sounds good. Let me know if I can help, so that we can get this over the finish line and get a release out if possible. Thanks! 🙏

@tompave
Copy link
Owner

tompave commented Aug 6, 2023

It's merged. I want to so some manual tests in a host phoenix app before cutting a release. Just to better understand how UUID PKs behave with FWF, or if it needs some more documentation.

@whatyouhide whatyouhide deleted the uuid-key-type branch August 6, 2023 19:56
@whatyouhide
Copy link
Contributor Author

@tompave sounds good! We're using FWF pretty heavily and have been using this change for a while if it helps. Let me know if I can help with the testing in any case.

@tompave
Copy link
Owner

tompave commented Aug 27, 2023

Apologies for the wait.
This has now been published on Hex: https://hex.pm/packages/fun_with_flags/1.11.0

@whatyouhide
Copy link
Contributor Author

Thank you so much @tompave 🙏!

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