bruvellu / cifonauta

Marine biology image database by CEBIMar/USP
http://cifonauta.cebimar.usp.br
GNU General Public License v3.0
21 stars 5 forks source link

Create management command for media migration between users #279

Open bruvellu opened 6 months ago

bruvellu commented 6 months ago

Each Media instance now needs to be associated with a user. The model also has new image fields which will replace the old sitepath and coverpath. While newly uploaded images get these fields populated, the old images have these fields blank. To make a proper migration, the most important thing is to associate each old media with a user. The problem, is that there are dozens of users who are not in the Cifonauta database and might take a long time to create their accounts. But to be able to freeze the image fields, it'll be much easier if we associate these media to a single temporary user account. This is simple, but there are two complications. One is fetching the original file from source_media, copying/renaming it, and regenerating the thumbnails. The second challenge will be migrating these files from this temporary user to its proper user later on. That's why having a functional media migration management command might be handy.