-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add @schema_redact: :all_except_primary_keys module attribute to Ecto Schema #4599
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
Conversation
Fantastic! PKs by default sounds very reasonable. Thank you for working on this 💜 |
Hi @Nezteb, in this case, I would call it Btw, implementation wise, I'd implement it here: https://github.com/elixir-ecto/ecto/blob/master/lib/ecto/schema.ex#L1995-L1997 So it does something like this:
This way, you don't need to change changesets nor nothing else, we reuse the existing redact infrastructure. WDYT? |
b3638a7
to
6229c00
Compare
88b45ee
to
d2642e8
Compare
💚 💙 💜 💛 ❤️ |
Initial proposal: https://groups.google.com/g/elixir-ecto/c/kQJN-7HPn6E
@josevalim initially approved of the second of my two proposed options:
While implementing, I realized that it's probably not best to redact all fields. I opted to keep the primary keys of a schema even if
@schema_redact
is set to something like:all
, hence the rename to:all_except_primary_keys
.TODO:
Future ideas:
@schema_redact: :all
, but would that be useful?