<div dir="ltr">In Pulp 2, having id fields bit us really badly. The reason may have been specific to Mongoengine, but my understanding is that it is bad practice anyway. </div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 23, 2018 at 9:22 AM, David Davis <span dir="ltr"><<a href="mailto:daviddavis@redhat.com" target="_blank">daviddavis@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 class="gmail_extra"><div><div class="m_-9010432385516829290m_7707780355828939966gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Correct me if I’m wrong but don’t we call pk in most places instead of id? If so, it would seem like replacing id with pulp_id wouldn’t be that ugly.</div><div><br></div><div>Also, I wonder about the created and last_updated fields. Seems like those could cause conflicts in the future too. At the very least, it might be nice to document which field names are reserved on the Content model.</div><div><br></div><div>David<br></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote"><div><div class="h5">On Wed, May 23, 2018 at 8:50 AM, 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><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></blockquote></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="h5"><div dir="ltr"><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><span class="m_-9010432385516829290m_7707780355828939966gmail-HOEnZb"><font color="#888888"><div><br></div><div>-Brian<br></div></font></span></div>
<br></div></div>______________________________<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>
<br>______________________________<wbr>_________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/<wbr>mailman/listinfo/pulp-dev</a><br>
<br></blockquote></div><br></div>