Refactor #5457
Story #5443: [Epic] Remove leading _ from pulpcore model fields
Prepend 'pulp' to fields on Model
100%
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
Associated revisions
Revision 247c4bed
View on GitHub
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
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
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
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
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
Renaming base fields
_id to pulp_id _created to pulp_created _last_updated to pulp_last_updated _href to pulp_href
Revision 70e69cc6
View on GitHub
Renaming base fields
_id to pulp_id _created to pulp_created _last_updated to pulp_last_updated _href to pulp_href
Revision 945b464e
View on GitHub
Renaming base fields
_id to pulp_id _created to pulp_created _last_updated to pulp_last_updated _href to pulp_href
Revision 945b464e
View on GitHub
Renaming base fields
_id to pulp_id _created to pulp_created _last_updated to pulp_last_updated _href to pulp_href
Revision 945b464e
View on GitHub
Renaming base fields
_id to pulp_id _created to pulp_created _last_updated to pulp_last_updated _href to pulp_href
Revision 945b464e
View on GitHub
Renaming base fields
_id to pulp_id _created to pulp_created _last_updated to pulp_last_updated _href to pulp_href
Revision 052aa4c2
View on GitHub
Renaming base fields
_id to pulp_id _created to pulp_created _last_updated to pulp_last_updated _href to pulp_href
Revision b1d689f0
View on GitHub
Renaming base fields
_id to pulp_id _created to pulp_created _last_updated to pulp_last_updated _href to pulp_href
Revision b1d689f0
View on GitHub
Renaming base fields
_id to pulp_id _created to pulp_created _last_updated to pulp_last_updated _href to pulp_href
Revision b1d689f0
View on GitHub
Renaming base fields
_id to pulp_id _created to pulp_created _last_updated to pulp_last_updated _href to pulp_href
History
#1
Updated by dkliban@redhat.com over 1 year ago
- Tracker changed from Issue to Refactor
- % Done set to 0
#2
Updated by dkliban@redhat.com over 1 year ago
- Description updated (diff)
#3
Updated by dalley over 1 year 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 over 1 year 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 over 1 year ago
dkliban@redhat.com 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_updatedThe 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 over 1 year 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 over 1 year 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 over 1 year ago
+0. Not a big fan of this change but I see no other path forward.
#9
Updated by ttereshc over 1 year ago
+0.75 for prepending everything with pulp_. I agree with @daviddavis.
#10
Updated by fao89 over 1 year ago
- Sprint set to Sprint 60
#11
Updated by fao89 over 1 year ago
- Status changed from NEW to ASSIGNED
- Assignee set to fao89
#12
Updated by dalley over 1 year 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 over 1 year ago
Let's open a separate ticket to remove _ from "_versions_href" and "_latest_version_href".
#14
Updated by fao89 over 1 year ago
pulpcore: https://github.com/pulp/pulpcore/pull/317
pulpcore-plugin: https://github.com/pulp/pulpcore-plugin/pull/137
pulp_file: https://github.com/pulp/pulp_file/pull/284
pulp-certguard: https://github.com/pulp/pulp-certguard/pull/31
pulp-smash: https://github.com/PulpQE/pulp-smash/pull/1220
plugin_template: https://github.com/pulp/plugin_template/pull/115
pulp_rpm: https://github.com/pulp/pulp_rpm/pull/1466
pulp_ansible: https://github.com/pulp/pulp_ansible/pull/218
pulp_docker: https://github.com/pulp/pulp_docker/pull/424
pulp_deb: https://github.com/pulp/pulp_deb/pull/125
pulp-2to3-migration: https://github.com/pulp/pulp-2to3-migration/pull/29
pulp_python: https://github.com/pulp/pulp_python/pull/259
pulp_maven: https://github.com/pulp/pulp_maven/pull/22
#15
Updated by fao89 over 1 year ago
- Status changed from ASSIGNED to POST
#16
Updated by Anonymous over 1 year ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulpcore|96bb65e9d8b55c04234c871df14059a32aa2fd5e.
#17
Updated by daviddavis over 1 year ago
- Status changed from MODIFIED to POST
#18
Updated by daviddavis over 1 year ago
- Status changed from POST to MODIFIED
#19
Updated by dalley about 1 year ago
- Status changed from MODIFIED to POST
#20
Updated by rchan about 1 year ago
- Sprint changed from Sprint 60 to Sprint 61
#21
Updated by fao89 about 1 year ago
- Status changed from POST to MODIFIED
#22
Updated by bmbouter about 1 year ago
- Sprint/Milestone set to 3.0.0
#23
Updated by bmbouter about 1 year ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Please register to edit this issue
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