Skip to content

Cascade delete issues with Overhead #218

@nvernooy

Description

@nvernooy

Overheads are not deleted when its Project is deleted.

I added a "cascade='all'" to the Overheads relationship in Projects.

But then deleting a Project caused a SQLAlchemy error:

StaleDataError: DELETE statement on table many to many

I'm assuming from the many-to-many relationship between Overheads and BudgetItems.

Using the solution here: http://stackoverflow.com/questions/28824401/sqlalchemy-attempting-to-twice-delete-many-to-many-secondary-relationship
And adding
engine.dialect.supports_sane_rowcount = engine.dialect.supports_sane_multi_rowcount = False
to init.py fixed the error.

Keeping this issue open in case there are any side effects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions