Skip to content
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

Rollback should include all owned records #94

Closed
2 tasks done
chillu opened this issue Jan 30, 2018 · 1 comment
Closed
2 tasks done

Rollback should include all owned records #94

chillu opened this issue Jan 30, 2018 · 1 comment

Comments

@chillu
Copy link
Member

chillu commented Jan 30, 2018

Overview

Acceptance Criteria

When rolling back a version record with a versioned owned relationship:

  • Owned records which have been added after this version will be archived and disassociated
  • Owned records which have been deleted after this version will be reassociated as draft (from archive table)
  • The owner record is created with a new version, and stays in draft until explicitly published (already built in)
  • Owned records reassociated through the new version stay in draft until explicitly published
  • Other records included in the page view (not owned) are not affected by the rollback

Notes

  • Ideally we can use the same logic as for archive mode: Walk through all owned relationships recursively, and find the closest entry to the publish date of the version we're rolling back to. This would avoid creating strong data model links just for a relatively fringe use case of rollbacks, e.g. adding an OwnerVersion database field to has_many relationships. To make that query directly on the version, we'd need to recursively write new versions of each owned relationship when the owner is published, even though there are no changes in those records. That'll significantly slow down and complicate the much more common publish operation, and significantly increase database size.
  • ChangeSet can't be used for per-page reverts, since it might contain more than one page and there's no direct relationship between implicitly added items in a changeset and their owner
  • Assumes all relationship types can be versioned already

PRs:

@tractorcow
Copy link
Contributor

Looking to implement some symmetry with publishSingle() / publishRecursive()

/**
     * Recursively rollback draft to the given version
     *
     * @param int|string $version Version ID or stage name
     */
    public function rollbackRecursive($version)
    {
        // todo
    }

    /**
     * Rollback draft to a given version
     *
     * @param int|string $version Version ID or stage name
     */
    public function rollbackSingle($version)
    {
        // todo
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants