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

Add versioning support for content [was: Allow to undelete content] #265

Open
nidico opened this Issue Sep 27, 2013 · 8 comments

Comments

Projects
None yet
4 participants
@nidico
Copy link

nidico commented Sep 27, 2013

It'd be very useful to only mark content as deleted, in order to undelete it later, in order to avoid accidental deletions.

Alternatively, full content versioning would also solve this, and would also be very useful of course, but this is much more work of course.

@dnouri

This comment has been minimized.

Copy link
Member

dnouri commented Sep 27, 2013

Not sure it's so much work really. At least @disko was talking about how he used that SQLAlchemy recipe in his project.

I'd like to add versioning as an add-on, and not as part of the core. PRs welcome.

@disko

This comment has been minimized.

Copy link
Member

disko commented May 13, 2014

FTR looking into http://sqlalchemy-continuum.readthedocs.org/en/latest/ might be a good idea…

@disko disko added this to the 1.x milestone Nov 17, 2014

@disko disko changed the title Allow to undelete content Add versioning support for content [was: Allow to undelete content] Nov 25, 2014

@piotr-dobrogost

This comment has been minimized.

Copy link
Contributor

piotr-dobrogost commented Aug 24, 2015

There's related topic on project's forum titled Versioning available at https://groups.google.com/forum/#!topic/kotti/mbKdNKJi1Hg

@piotr-dobrogost

This comment has been minimized.

Copy link
Contributor

piotr-dobrogost commented Sep 2, 2015

Just trying to version Node table with SQLAlchemy-Continnum (https://gist.github.com/piotr-dobrogost/b529e7914c0f90921551, piotr-dobrogost@a6712b7) gives the following error:

sqlalchemy.exc.InvalidRequestError: Implicitly combining column contents_version.transaction_id with column nodes_version.transaction_id under attribute 'transaction_id'. Please configure one or more attributes for these same-named columns explicitly.

Where and how could I configure attributes for these columns?

@piotr-dobrogost

This comment has been minimized.

Copy link
Contributor

piotr-dobrogost commented Sep 4, 2015

I managed to write a test case which I posted at kvesteri/sqlalchemy-continuum#105 I would appreciate if someone could take a look. Btw, why doesn't Document class declare its own polymorphic identity? As the problem exists only after declaring this class I guess this might be the source of problem.

@disko

This comment has been minimized.

Copy link
Member

disko commented Sep 4, 2015

Btw, why doesn't Document class declare its own polymorphic identity?

polymorphic_identity is set automatically through this class property for Content and all descendants: https://github.com/Kotti/Kotti/blob/master/kotti/resources.py#L537

W.r.t. the test case: you'd either need to also add __mapper_args__ to the Document class or change it to something like this on the Content class::

  @classproperty
      def __mapper_args__(cls):
          return dict(polymorphic_identity=cls.__name__.lower())
@piotr-dobrogost

This comment has been minimized.

Copy link
Contributor

piotr-dobrogost commented Sep 6, 2015

polymorphic_identity is set automatically (...)

You are right, I missed it.

W.r.t. the test case: you'd either need to also add __mapper_args__ to the Document class or change it to something like this on the Content class::

I edited test case and added __mapper_args__ as @classproperty as you suggested. Warnings about Reassigning polymorphic association (...) are gone but the error is the same.

@piotr-dobrogost

This comment has been minimized.

Copy link
Contributor

piotr-dobrogost commented Sep 7, 2015

With no replies on SQLAlchemy-Continuum's tracker I also posted to SQLAlchemy's mailing list and asked on Stackoverflow.

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