Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add option of existingType to .enum method to support repeated use of enums #2719
I was super happy to see knex supporting native enums in postgres, but when I had an enum that I used repeatedly across different columns in different tables, I was running into errors as the
Could we add a flag in the options param to not run the sql that creates the type enum?
The first time you run it you could do
And then the other times you can run
Okay, @kibertoad added some tests.
Corresponding Docs: knex/documentation#147
Since it is just using an existing type, we could allow the api to be
As it is a bit weird to have to specify an array of values that aren't actually going to be used (since the type is already created, it just utilizes the
The code would need to be changed to something like so:
Finally it looks like we are still getting a drop in code coverage. I can add more tests, but they would be like "expect error when x" tests.