Refactor #5457
closedStory #5443: [Epic] Remove leading _ from pulpcore model fields
Prepend 'pulp' to fields on Model
Added by dkliban@redhat.com about 5 years ago. Updated almost 5 years ago.
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
Updated by dkliban@redhat.com about 5 years ago
- Tracker changed from Issue to Refactor
- % Done set to 0
Updated by dalley about 5 years 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.
Updated by dkliban@redhat.com about 5 years 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.
Updated by bmbouter about 5 years 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.
Updated by dkliban@redhat.com about 5 years ago
- Subject changed from Remove leading _ from fields on Model to Prepend 'pulp' to fields on Model
- Description updated (diff)
Updated by daviddavis about 5 years ago
+0. Not a big fan of this change but I see no other path forward.
Updated by ttereshc about 5 years ago
+0.75 for prepending everything with pulp_. I agree with @daviddavis.
Updated by fao89 about 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to fao89
Updated by dalley about 5 years 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.
Updated by dkliban@redhat.com about 5 years ago
Let's open a separate ticket to remove _ from "_versions_href" and "_latest_version_href".
Added by Fabricio Aguiar about 5 years ago
Updated by fao89 about 5 years 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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Updated by Anonymous about 5 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulpcore|96bb65e9d8b55c04234c871df14059a32aa2fd5e.
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Added by Fabricio Aguiar about 5 years ago
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
Updated by bmbouter almost 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
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