Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove statefulness from package extras
* This is part of getting rid of vdm. * We don't need to store state in PackageExtra any more because you can view the history via activity stream, since it now stores the full package_dict #3972. (The package_extra_revision table will be used to migrate old versions of the package to activity_streams migrate_package_activity.py. But from this version of CKAN, we do not need to record PackageExtra.stateit any more.) * The mapping between PackageExtra and Package is now a simply dict i.e. attribute_mapped_collection - not a vdm StatefulDict any more. * vdm's OurAssociationProxy is replaced by the vanilla sqlalchemy association_proxy - I'm not clear why we had to prevent scalars being assigned in the first place since it is a dict mapping, not a scalar mapping. Seems ok. * package_extras_save() now deletes PackageExtra objects, instead of changing state to 'deleted'. * package_no_state/extras_list is no longer needed because it was only used by package_extras_save() * migration deletes extras of state='deleted', otherwise they'd suddenly appear
- Loading branch information
David Read
committed
Mar 15, 2019
1 parent
bf985bf
commit e094531
Showing
5 changed files
with
28 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
ckan/migration/versions/088_delete_extras_which_are_deleted_state.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# encoding: utf-8 | ||
|
||
|
||
def upgrade(migrate_engine): | ||
migrate_engine.execute( | ||
''' | ||
ALTER TABLE "package_extra_revision" | ||
DROP CONSTRAINT package_extra_revision_continuity_id_fkey; | ||
DELETE FROM "package_extra" WHERE state='deleted'; | ||
''' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e094531
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch breaks various extensions which rely on
extras_list
(like https://github.com/ckan/ckanext-spatial). Do you plan to keep compatibility or is there any suggested way to patch the extensions?e094531
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for raising this @frafra. I see you've put in a fix for ckanext-spatial however I see that bit of code has been copied into a bunch of other repos, so worth adding back in. I've done a PR: #4778