I'm running tests on Postgres and it seems that dropping constraints do not include IF EXISTS before the constraint name.
E.g. I see similar logs to the one below:
Looking a bit into the code I noticed some problems:
Apparently ForeignKey.sqlDropString() that would respect Dialect.supportsIfExistsBeforeConstraintName() (or in fact any other sqlDropString() method) seems to be never called
Dialect.supportsIfExistsBeforeConstraintName() doesn't seem to be consistently applied. Constraint actually doesn't check it, ForeignKey does - but yet again: I can't see the call site of any sqlDropString(). StandardForeignKeyExporter.getSqlDropStrings() which is called in the process of dropping the schema doesn't respect those settings as well.
Any help and clarification is appreciated.
Hi, . Thanks for taking care of this. Out of interest: Was my observation correct that sqlDropString seems to be unused?
you are welcome. Thanks for reporting the issue.
About the code, the
was correctly called, but it generated a drop String statement without checking if the dialect supports If Exists before or after the constraint name, if you are interested you can can see the changeshere.
Sorry, I apparently haven't been clear enough in the comment. I already looked at your change prior to my first comment. (And it basically contains what I basically reported for the StandardForeignKeyExporter myself )
I was asking if ForeignKey.sqlDropString() or alike are called somewhere. (See my first bullet-point from the ticket description). If not, one could think of removing it for maintainability purposes in a follow-up ticket (At the very least it is quite confusing to keep it around if no-one uses it).
you are right, the method is not used anymore, it will be deprecated in 6.0 and then removed, what we can consider is to deprecate it in 5.3 and then remove in the 6.0 release.