Project

Profile

Help

Refactor #5457

Story #5443: [Epic] Remove leading _ from pulpcore model fields

Prepend 'pulp' to fields on Model

Added by dkliban@redhat.com 29 days ago. Updated 6 days ago.

Status:
MODIFIED
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
% Done:

100%

Platform Release:
Blocks Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Complexity:
Verified:
No
Verification Required:
No
Sprint:
Sprint 60

Description

pulpcore.app.models.Model has three fields0 that all start with an _. All these fields need to drop the _ prefix from their names.

_id will become pulp_id
_created will become pulp_created
_last_updated will become pulp_last_updated

The URL field name, _href, is defined in the settings.py0.

_href will become pulp_href

[0] https://github.com/pulp/pulpcore/blob/3c62889e0c01fe54de66c60147192a03cac73ab2/pulpcore/app/models/base.py#L21-L23
[1] https://github.com/pulp/pulpcore/blob/3c62889e0c01fe54de66c60147192a03cac73ab2/pulpcore/app/settings.py#L117


Checklist

Associated revisions

Revision 69df3448 View on GitHub
Added by Fabricio Aguiar 14 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

Required PR: https://github.com/pulp/pulp_file/pull/284
Required PR: https://github.com/pulp/pulpcore-plugin/pull/137
Required PR: https://github.com/PulpQE/pulp-smash/pull/1220

Revision 247c4bed View on GitHub
Added by Fabricio Aguiar 9 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

Required PR: https://github.com/pulp/pulpcore/pull/317
Required PR: https://github.com/pulp/pulpcore-plugin/pull/137
Required PR: https://github.com/PulpQE/pulp-smash/pull/1220

Revision 39c654e7 View on GitHub
Added by Fabricio Aguiar 7 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457
Required PR: https://github.com/pulp/pulpcore/pull/317
Required PR: https://github.com/pulp/pulp_file/pull/284
Required PR: https://github.com/PulpQE/pulp-smash/pull/1220

Revision 96bb65e9 View on GitHub
Added by Fabricio Aguiar 7 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

closes #5457
https://pulp.plan.io/issues/5457

Required PR: https://github.com/pulp/pulp_file/pull/284
Required PR: https://github.com/pulp/pulpcore-plugin/pull/137
Required PR: https://github.com/PulpQE/pulp-smash/pull/1220
Required PR: https://github.com/pulp/pulp-certguard/pull/31

Revision 83608d21 View on GitHub
Added by Fabricio Aguiar 7 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

Required PR: https://github.com/pulp/pulpcore-plugin/pull/137
Required PR: https://github.com/pulp/pulpcore/pull/317
Required PR: https://github.com/PulpQE/pulp-smash/pull/1220

Revision 99ad773e View on GitHub
Added by Fabricio Aguiar 7 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

Required PR: https://github.com/pulp/pulp_file/pull/284
Required PR: https://github.com/pulp/pulpcore-plugin/pull/137
Required PR: https://github.com/PulpQE/pulp-smash/pull/1220
Required PR: https://github.com/pulp/pulpcore/pull/317

Revision 45761f7f View on GitHub
Added by Fabricio Aguiar 7 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

Revision 70e69cc6 View on GitHub
Added by Fabricio Aguiar 7 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

Revision 945b464e View on GitHub
Added by Fabricio Aguiar 7 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

Revision 945b464e View on GitHub
Added by Fabricio Aguiar 7 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

Revision 052aa4c2 View on GitHub
Added by Fabricio Aguiar 6 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

Revision b1d689f0 View on GitHub
Added by Fabricio Aguiar 6 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

Revision b1d689f0 View on GitHub
Added by Fabricio Aguiar 6 days ago

Renaming base fields

_id to pulp_id
_created to pulp_created
_last_updated to pulp_last_updated
_href to pulp_href

ref #5457
https://pulp.plan.io/issues/5457

History

#1 Updated by dkliban@redhat.com 29 days ago

  • Tracker changed from Issue to Refactor
  • % Done set to 0

#2 Updated by dkliban@redhat.com 29 days ago

  • Description updated (diff)

#3 Updated by dalley 23 days ago

If we remove the leading _ from _id then we're back to the place we were originally -- we need to find a new name for the pk field, or else, plugins will need to avoid "id", which is a pretty common name for a field.

Either would work, but we should decide on a strategy going forwards.

e.g. UpdateRecord https://github.com/pulp/pulp_rpm/blob/master/pulp_rpm/app/models.py#L386

The same applies to _href -> href, if we decide to do that.

https://github.com/pulp/pulp_rpm/blob/master/pulp_rpm/app/models.py#L666

I have no example of "last_updated" but I feel like it would be a likely future conflict.

Personally, I propose using a "pulp_" prefix.

#4 Updated by dkliban@redhat.com 23 days ago

Adding a 'pulp' or 'pulpcore' to the field names would eliminate the chance of conflict between fields provided by pulpcore and the plugin.

pulp_id
pulp_href
pulp_created
pulp_last_updated

The names are very descriptive. They eliminate ambiguity for the REST API users.

#5 Updated by bmbouter 23 days ago

wrote:

Adding a 'pulp' or 'pulpcore' to the field names would eliminate the chance of conflict between fields provided by pulpcore and the plugin.

pulp_id
pulp_href
pulp_created
pulp_last_updated

The names are very descriptive. They eliminate ambiguity for the REST API users.

+1, these names are descriptive and they avoid the conflicts so I think that is the goal.

#6 Updated by dkliban@redhat.com 23 days ago

  • Checklist item update field names added
  • Checklist item update pulpcore use of these field names added
  • Checklist item update pulpcore-plugin use of these field names added
  • Checklist item update plugins use of these field names added
  • Checklist item update docs in all repos added
  • Subject changed from Remove leading _ from fields on Model to Prepend 'pulp' to fields on Model
  • Description updated (diff)

#7 Updated by dkliban@redhat.com 23 days ago

  • Checklist item changed from update field names to update field names on the Model and settings.py
  • Checklist item update the serializer field names to match added

#8 Updated by daviddavis 23 days ago

+0. Not a big fan of this change but I see no other path forward.

#9 Updated by ttereshc 22 days ago

+0.75 for prepending everything with pulp_. I agree with @daviddavis.

#10 Updated by fabricio.aguiar 15 days ago

  • Sprint set to Sprint 60

#11 Updated by fabricio.aguiar 15 days ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to fabricio.aguiar

#12 Updated by dalley 15 days ago

Should we also change the names of "_versions_href" and "_latest_version_href" on RepositoryVersion? We would not need a "pulp_" prefix, but we would potentially want to drop the "_" prefix. I do not know whether that is an issue for the bindings the same way that the others were (as I don't think we filter on those fields at all), but since we're getting rid of that pattern everywhere else, it might no longer fit ergonomically speaking. And, it is not particularly necessary as nobody subclasses RepositoryVersion.

#13 Updated by dkliban@redhat.com 14 days ago

Let's open a separate ticket to remove _ from "_versions_href" and "_latest_version_href".

#15 Updated by fabricio.aguiar 13 days ago

  • Status changed from ASSIGNED to POST

#16 Updated by Anonymous 7 days ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#17 Updated by daviddavis 7 days ago

  • Status changed from MODIFIED to POST

#18 Updated by daviddavis 6 days ago

  • Status changed from POST to MODIFIED

Please register to edit this issue

Also available in: Atom PDF