#2030 Fix deleting a project
Merged by pingou. Opened by pingou.
fix_deletion  into  master

Download 2030.patch

We used to run into some error when deleting a project, such as:
StaleDataError: DELETE statement on table 'projects_groups'
expected to delete 1 row(s); Only 0 were matched.
which just entirely blocked deleting the project.

We were also seeing a warning:
SAWarning: DELETE statement on table 'tags_issues_colored'
expected to delete 1 row(s); 0 were matched. Please set
confirm_deleted_rows=False within the mapper configuration
to prevent this warning. (table.description, expected,
rows_matched)

It is only when we found the warning in the SQLAlchemy documentation
about basic relationship patterns:
http://docs.sqlalchemy.org/en/rel_1_0/orm/basic_relationships.html#association-object
and when we applied viewonly=True to our secondary relationships
that we were able to get ride of these errors and have our model behave
as desired.

We are also adding unit-tests to prevent this from occurring again.

rebased

rebased

LGTM.

Thanks for the review

Pull-Request has been merged by pingou

Metadata