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

FindConditions instead of any for EntityManager.delete() #4609

Closed
wants to merge 1 commit into from

Conversation

osdiab
Copy link
Contributor

@osdiab osdiab commented Aug 20, 2019

Context is in #4608 . I'm not 100% sure if this is correct for using delete properly (it passes the code directly to a QueryBuilder.where() clause, which I think can take FindConditions? But I'm not totally sure if that's how QueryBuilder works.

Having something like this would save my team and probably other's from blowing up their own dbs.

@pleerock
Copy link
Member

pleerock commented Sep 5, 2019

it won't support all FindConditions features, only some trivial ones

@Kononnable
Copy link
Contributor

Ok, so what should we do about this PR? Close it or change FindConditions to some subtype of it which would contain only features that work with delete? There are also tests missing which I consider necessary with such API.

@osdiab Are you still interested in this PR?

@osdiab
Copy link
Contributor Author

osdiab commented Oct 16, 2019

It would have been nice for past me but I'm used to it now that I'm not messing as much with the particular code - I do think it should probably go through in some form but I'm not sure what exactly to put there, as you've highlighted. If there's documentation somewhere about what delete can do that would be useful, otherwise I can delve into the delete code and grok it directly

@osdiab
Copy link
Contributor Author

osdiab commented Oct 16, 2019

This is the query builder code that criteria eventually gets used in: https://github.com/typeorm/typeorm/blob/master/src/query-builder/DeleteQueryBuilder.ts#L144

@osdiab
Copy link
Contributor Author

osdiab commented Oct 16, 2019

That would imply that a general, potentially correct option might be string|((qb: QueryBuilder<Entity>) => string)|Brackets|ObjectLiteral|ObjectLiteral[], though that is quite general/footgun prone

@pleerock
Copy link
Member

On the next branch we already have this change, and I suppose because its working better in there.

@AlexMesser
Copy link
Collaborator

Closing for now.

@AlexMesser AlexMesser closed this May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants