Opened 13 years ago
Last modified 12 years ago
#64 closed defect (FIXED)
MediaEntry['uploader'] should reference User, not embed it.
Reported by: | Christopher Allan Webber | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | 0.0.2 |
Component: | programming | Keywords: | |
Cc: | Parent Tickets: |
Description (last modified by )
Currently we embed the User object into the MediaEntry field. Bad, bad bad! This means all sorts of terrible things, but especially that we'll be keeping potentially out of date information. We should be referencing it instead.
Change History (10)
comment:2 by , 13 years ago
We could use autorefs which would use mostly the same API as we have now but would probably result in many extra queries than we would like to make. In other words, we could do: :: from pymongo.dbref import DBRef [...] class MediaEntry(Document): __collection__ = 'media_entries' structure = { 'uploader': DBRef, Which would be faster (one less query when we don't need to reference the User) but would require an extra query whenever we pull down a MediaEntry. We could probably add def user() to make that easier. Alternately we could turn on autorefs: `http://namlook.github.com/mongokit/dbref.html <http://namlook.github.com/mongokit/dbref.html>`_ And yeah, we'll probably migrate later. Actually doing a migration for this doesn't look hard, I just don't want to do it right now :)
comment:3 by , 13 years ago
We're pre-alpha. If something breaks, noone should cry. And it can all be easily fixed currently. IF the migration looks simple, why not try it? Major benefit: - We have an example migration in the code.- - It's tested, can be documented, etc. if the migration is harder, it **might** still be an oportunity to have a "big real world example". About auto\_refs: To me, this feels a little like magic. I don't know. The mongo experts should decide.
comment:5 by , 13 years ago
[https://gitorious.org/\ :sub:`cwebber/mediagoblin/cwebbers-mediagoblin/commits/user\_migration](https://gitorious.org/`\ cwebber/mediagoblin/cwebbers-mediagoblin/commits/user\_migration) I've made the migration here, it works. The rest of the system not updated yet to use the migration quite yet.
comment:6 by , 13 years ago
Oh by the way, to run bulk migrations you'll have to run ./bin/gmg migrate.
comment:10 by , 12 years ago
Component: | → programming |
---|---|
Description: | modified (diff) |
Note:
See TracTickets
for help on using tickets.