-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate ArchivedProject content to ActiveProject #2170
Conversation
c6e3870
to
0e5a9ab
Compare
Makes sense. Thanks. I think that we want to delete the ArchivedProject after migrating it. |
Thanks Benjamin. Deleted! |
Interesting error. call_command('purgeaccounts') Perhaps because of the But I didn't mean deleting the whole table necessarily. I meant, within your |
8b335ff
to
b72308d
Compare
Sorry, misunderstood! Now done. I'll remove the table in a later pull request in this case. |
I'm not sure if there is a reason for the particular set of fields being copied from ArchivedProject to ActiveProject (in line 28 onwards.) As it is, this is losing some information from the old project (e.g. It's instructive to look at the old archive() function which converted ActiveProjects into ArchivedProjects. It did this:
In other words, it would copy all of the fields in Metadata or SubmissionInfo, plus The only fields that weren't copied were Unfortunately we can't use the same approach in
|
…#2166. Note that we do not migrate files. Files for archived projects will remain in the pn-media/archived-projects subfolder. We should migrate them to pn-media/active-projects later.
b72308d
to
4d9494a
Compare
I'd walked through the fields, picking ones that I thought were important to keep. I have now implemented your more-complete approach. Good suggestion, thanks. |
thanks, looks great! |
As discussed in #2166, we would like to migrate content from the (now deprecated)
ArchivedProject
model to theActiveProject
model.This pull request:
slug="t2ASGLbIBoWaTJvPrM2A"
) fixture.I have tested this fairly comprehensively and have not found any issues.
Note that files are not migrated. Files for archived projects will remain in the
pn-media/archived-projects
subfolder. We should migrate them topn-media/active-projects
later.One way of testing is to:
1 . Reset to
c49b2a1c640a0a6c07ee135f3ff84d45e2baa4e3
(e.g.with git reset c49b2a1c640a0a6c07ee135f3ff84d45e2baa4e3 --hard
) which is the pull request prior to the archived status being added to the ActiveProject object.2. Create a bunch of interesting ArchivedProjects using the console. Add references, co-authors, copyediting history, etc.
3. Pull down the latest version of this branch.
4. Run the migrations to migrate ArchivedProjects to ActiveProjects.
5. Try viewing archived projects in the console, author project page, etc.
6. Change the submission status of the archived projects to unsubmitted (
p.submission_status = 0
) and save the change.7. Check whether the now-active projects are correctly populated in the author submission system. You should find that all pages work correctly, except
http://localhost:8000/projects/SLUG/files/
, which will raise aFileNotFoundError
as expected.