Open therealsujitk opened 2 months ago
On a separate note I noticed a bug, if you specify default
as ''
(an empty string), it simply ignores it. I'm guessing this is because to check if a default value is set we use if (param.default) { ... }
or something similar, but an empty string returns false
as well and so it gets ignored.
Edit: Here's the issue --> https://github.com/salsita/node-pg-migrate/blob/main/src/utils/formatParams.ts#L30
Description
Currently when you drop a function, it requires you to pass the parameters for the function, and since I don't want to write these parameters twice I create a common variable and use it in both the up and the down migrations. The issue is if a parameter has a default value set, dropping the function throws an error.
Suggested solution
Ignore the
default
property in thedropFunction()
method while creating the query.Alternative
A workaround for this would be to recreate the params array for the delete function without the
default
property, or to create a helper method that deletes this property and returns a new array that can be used to drop the function.Additional context
No response