Open colinallen opened 7 years ago
passes unit test for entity deletion, but that tests only 'idea' deletion, which I was also able to do via curl
For thinker 3002 (duplication of FIchte), the error is Error - <class 'sqlalchemy.exc.IntegrityError'>: (IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (seponto
.thinker_has_influenced
, CONSTRAINT fk_thinker_has_influenced_thinker1
FOREIGN KEY (thinker1_id
) REFERENCES thinker
(ID
) ON DELETE NO ACTION ON UPDATE NO ACTION)') 'DELETE FROM thinker WHERE thinker.ID
= %s' (3002,)
So it appears that entity can be deleted because it's mentioned elsewhere.
Related but different reason for 5679:
Error - <class 'sqlalchemy.exc.IntegrityError'>: (IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (seponto
.date
, CONSTRAINT fk_date_entity1
FOREIGN KEY (entity_id
) REFERENCES entity
(ID
) ON DELETE NO ACTION ON UPDATE NO ACTION)') 'DELETE FROM entity WHERE entity.ID
= %s' (5679,)
Also getting error for some ideas -- e.g. https://www.inphoproject.org/idea/5696 (fallacies) which is a duplicate of https://www.inphoproject.org/idea/1980 -- both give internal server error on attempt to delete.
I am curious as to whether a SQL Alchemy update would just fix this... inphosite
depends on v0.6.9
released on May 6, 2012. SQL Alchemy is now on v1.2.0
.
Without unit tests, I'm hesitant to simply upgrade. This could be good motivation for testing the project and getting Travis-CI integration, like we have with vsm/topic-explorer.
I have modified some of the foreign key constraints
SHOW CREATE TABLE `thinker_has_influenced`;
ALTER TABLE `thinker_has_influenced`
DROP FOREIGN KEY `fk_thinker_has_influenced_thinker1`;
ALTER TABLE `thinker_has_influenced`
ADD CONSTRAINT fk_thinker_has_influenced_thinker1
FOREIGN KEY (thinker1_id) REFERENCES thinker(ID)
ON DELETE CASCADE;
ALTER TABLE `thinker_has_influenced`
DROP FOREIGN KEY `fk_thinker_has_influenced_thinker2`;
ALTER TABLE `thinker_has_influenced`
ADD CONSTRAINT fk_thinker_has_influenced_thinker2
FOREIGN KEY (thinker2_id) REFERENCES thinker(ID)
ON DELETE CASCADE;
I've got to do this for more tables.
SHOW CREATE TABLE `date`;
ALTER TABLE `date`
DROP FOREIGN KEY `fk_date_entity1`;
ALTER TABLE `date`
ADD CONSTRAINT `fk_date_entity1`
FOREIGN KEY (`entity_id`) REFERENCES `entity` (`ID`)
ON DELETE CASCADE;
SHOW CREATE TABLE `thinker_teacher_of`;
ALTER TABLE `thinker_teacher_of`
DROP FOREIGN KEY `fk_thinker_teacher_of_thinker1`,
DROP FOREIGN KEY `fk_thinker_teacher_of_thinker2`;
ALTER TABLE `thinker_teacher_of`
ADD CONSTRAINT `fk_thinker_teacher_of_thinker1` FOREIGN KEY (`thinker1_id`) REFERENCES `thinker` (`ID`) ON DELETE CASCADE,
ADD CONSTRAINT `fk_thinker_teacher_of_thinker2` FOREIGN KEY (`thinker2_id`) REFERENCES `thinker` (`ID`) ON DELETE CASCADE;
Successfully deleted:
Now attempting to figure out the idea tables to delete 1980 - same issues I suspect.
Different issue:
UnmappedColumnError: Can't execute sync rule for source column 'idea.ID'; mapper 'Mapper|IdeaGraphEdge|idea_graph_edges' does not map this column. Try using an explicit `foreign_keys` collection which does not include destination column 'idea_graph_edges.ante_id' (or use a viewonly=True relation).
I have successfully deleted all the thinker instances that I had previously marked for deletion, so just ideas now. (Noting in passing that remaining problem no longer matches issue title.)
I'm marking up entities that I can't delete with the words "marked for deletion" in the label, so can be retrieved as https://www.inphoproject.org/entity?redirect=true&q=deletion
Internal server error response with curl -X DELETE -u user:password https://inpho.cogs.indiana.edu/thinker/5679