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 7 months ago. Updated 4 months ago.

Status:
CLOSED - CURRENTRELEASE
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 61

Description

pulpcore.app.models.Model has three fields[0] 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.py[0].

_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 6 months 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 6 months 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 fce769c3 View on GitHub
Added by Fabricio Aguiar 6 months 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 96bb65e9 View on GitHub
Added by Fabricio Aguiar 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 months 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 months 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 months 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 months 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 7 months ago

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

#2 Updated by dkliban@redhat.com 7 months ago

  • Description updated (diff)

#3 Updated by dalley 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months ago

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

#9 Updated by ttereshc 6 months ago

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

#10 Updated by fabricio.aguiar 6 months ago

  • Sprint set to Sprint 60

#11 Updated by fabricio.aguiar 6 months ago

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

#12 Updated by dalley 6 months 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 6 months ago

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

#15 Updated by fabricio.aguiar 6 months ago

  • Status changed from ASSIGNED to POST

#16 Updated by Anonymous 6 months ago

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

#17 Updated by daviddavis 6 months ago

  • Status changed from MODIFIED to POST

#18 Updated by daviddavis 6 months ago

  • Status changed from POST to MODIFIED

#19 Updated by dalley 5 months ago

  • Status changed from MODIFIED to POST

#20 Updated by rchan 5 months ago

  • Sprint changed from Sprint 60 to Sprint 61

#21 Updated by fabricio.aguiar 5 months ago

  • Status changed from POST to MODIFIED

#22 Updated by bmbouter 4 months ago

  • Sprint/Milestone set to 3.0.0

#23 Updated by bmbouter 4 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF