<div dir="ltr"><div>I wrote up a Redmine issue to make this change here: <a href="https://pulp.plan.io/issues/3704" target="_blank">https://pulp.plan.io/issues/<wbr>3704</a> Please look at it and groom it if it looks ready.<br></div><div><br></div><div>@jortel I especially want to make sure you're comfortable with this change.<br></div><div><br></div><div>If anyone is -1 on this change please reply saying so.<br></div><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 24, 2018 at 5:06 PM, Brian Bouterse <span dir="ltr"><<a href="mailto:bbouters@redhat.com" target="_blank">bbouters@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div><div>+1 to using _id, _created, and _last_updated only on MasterModel. It looks like leading underscores for field names are fine: <a href="https://stackoverflow.com/a/25509372" target="_blank">https://stackoverflow.com/a/25<wbr>509372</a> That will resolve this issue. Also everyone can still use .pk instead of ._id because Django automatically makes a .pk attribute on every model that also acts as the primary key regardless of the primary key's name. Also I don't think we have this issue elsewhere, only because Content is so heavily subclassed so I don't think we'll do leading _ to field names in other places.<br></div><div><br></div><div>@jortel I don't understand what you wrote; maybe try explaining it some more? The field "id" a plugin writer would define would contain the data they are obligated to hold for that content type. They didn't select the name "id"; it's the name the designers of that content type selected when they modeled that content type. So the designers of Errata itself chose Errata.id and what data should go inside there.<br></div></div><div class="m_2165946936433141867HOEnZb"><div class="m_2165946936433141867h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 23, 2018 at 10:33 AM, Jeff Ortel <span dir="ltr"><<a href="mailto:jortel@redhat.com" target="_blank">jortel@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
In classic relational modeling, using ID as the primary key is
common practice. Especially when ORMs are involved. The "id" added
by plugin writers is a natural key so naming it ID goes against
convention. Every field in base models used by plugins has
potential for name collisions. Where does it end? Every column
having a pulp_ or _ prefix? Plugins create relatively few tables
and it doesn't seem unreasonable for plugin writers to select other
names to resolve naming conflicts.<div><div class="m_2165946936433141867m_7602619907835113123h5"><br>
<br>
<div class="m_2165946936433141867m_7602619907835113123m_-4443883462590796228moz-cite-prefix">On 05/23/2018 07:50 AM, Brian Bouterse
wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="m_2165946936433141867m_7602619907835113123h5">
<div dir="ltr">
<div>Currently the Content model [0] has 'id' as it's primary
key which is inherited from MasterModel here [1]. By naming
our pk 'id', we are preventing plugin writers from also using
that field. That field name is common for content types. For
example: both RPM and Nuget content also expect to use the
'id' field to store data about the content type itself (not
Pulp's pk). We learned about the Nuget incompatibility at
ConfigMgmgtCamp from a community member. I learned about this
issue with RPM from @dalley.<br>
</div>
<div><br>
</div>
<div>The only workaround a plugin writer has is to call their
field 'rpm_id' or something like that. I don't see how it's
unavoidable that this renaming won't be passed directly onto
the user for things like filtering, creating units, etc. I
think that is an undesirable outcome just so that the Pulp pk
can be named 'id'.</div>
<div><br>
</div>
<div>One option would be to rename 'id' to 'pulp_id' at the
MasterModel. This is also somewhat ugly for Pulp developers,
but it would be (a) crystal clear to the user in all cases and
(b) allow Content writers to model their content types
correctly.</div>
<div><br>
</div>
<div>Another option would be to rename the pk for 'Content'
specifically and not at the MasterModel level. I think that
would create more confusion than benefit so I recommend doing
it at the MasterModel level.<br>
</div>
<div><br>
</div>
<div>What do you all think?</div>
<div><br>
</div>
<div>[0]: <a href="https://github.com/pulp/pulp/blob/6f492ee8fac94b8562dc62d87e6886869e052e7e/pulpcore/pulpcore/app/models/content.py#L106" target="_blank">https://github.com/pulp/pulp/b<wbr>lob/6f492ee8fac94b8562dc62d87e<wbr>6886869e052e7e/pulpcore/pulpco<wbr>re/app/models/content.py#L106</a><br>
</div>
<div>[1]: <a href="https://github.com/pulp/pulp/blob/d1dc089890f167617fe9917af087d5587708296b/pulpcore/pulpcore/app/models/base.py#L25" target="_blank">https://github.com/pulp/pulp/b<wbr>lob/d1dc089890f167617fe9917af0<wbr>87d5587708296b/pulpcore/pulpco<wbr>re/app/models/base.py#L25</a></div>
<div><br>
</div>
<div>-Brian<br>
</div>
</div>
<br>
<fieldset class="m_2165946936433141867m_7602619907835113123m_-4443883462590796228mimeAttachmentHeader"></fieldset>
<br>
</div></div><span><pre>______________________________<wbr>_________________
Pulp-dev mailing list
<a class="m_2165946936433141867m_7602619907835113123m_-4443883462590796228moz-txt-link-abbreviated" href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a>
<a class="m_2165946936433141867m_7602619907835113123m_-4443883462590796228moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/pulp-dev" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/pulp-dev</a>
</pre>
</span></blockquote>
<br>
</div>
<br>______________________________<wbr>_________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/pulp-dev</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>