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

OperatorsInFeed: Should be deleted when Operator is deleted #797

Closed
irees opened this issue Sep 19, 2016 · 2 comments
Closed

OperatorsInFeed: Should be deleted when Operator is deleted #797

irees opened this issue Sep 19, 2016 · 2 comments
Assignees

Comments

@irees
Copy link
Member

irees commented Sep 19, 2016

When an Operator is deleted, it should also clean up any OperatorInFeed records that reference it.

Example: an Operator was removed by a changeset. https://github.com/transitland/transitland/issues/113

@irees irees self-assigned this Sep 19, 2016
@irees
Copy link
Member Author

irees commented Sep 19, 2016

Manual cleanup of the following OIFs:

irb(main):004:0> oifs = OperatorInFeed.all.select { |oif| oif.operator == nil }
irb(main):005:0> puts oifs.to_json
[{"id":15,"gtfs_agency_id":null,"version":1,"created_at":"2016-02-10T20:26:33.547Z","updated_at":"2016-02-10T20:26:33.547Z","operator_id":10,"feed_id":15,"created_or_updated_in_changeset_id":518},{"id":16,"gtfs_agency_id":null,"version":1,"created_at":"2016-02-10T20:28:42.067Z","updated_at":"2016-02-10T20:28:42.067Z","operator_id":11,"feed_id":16,"created_or_updated_in_changeset_id":519},{"id":394,"gtfs_agency_id":"ACTV S.p.a","version":1,"created_at":"2016-07-15T02:21:18.266Z","updated_at":"2016-07-15T02:21:18.266Z","operator_id":367,"feed_id":317,"created_or_updated_in_changeset_id":1264},{"id":450,"gtfs_agency_id":"RTL","version":2,"created_at":"2016-07-29T18:27:40.352Z","updated_at":"2016-08-22T16:01:31.316Z","operator_id":422,"feed_id":58,"created_or_updated_in_changeset_id":1737},{"id":624,"gtfs_agency_id":null,"version":1,"created_at":"2016-08-25T18:32:26.567Z","updated_at":"2016-08-25T18:32:26.567Z","operator_id":601,"feed_id":404,"created_or_updated_in_changeset_id":1739}]
irb(main):007:0> oifs.each { |oif| oif.delete }

The operator_id is not nil, but is a dangling reference to the Operator that was deleted.

@drewda
Copy link
Member

drewda commented Sep 19, 2016

@kkowalsky followed up with support requester under ticket #999

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

2 participants