knex / knex-schema-inspector

Utility for extracting information about existing DB schema
MIT License
99 stars 43 forks source link

Add support for listing unique constraints #148

Open Niikelion opened 12 months ago

Niikelion commented 12 months ago

Hello there! I find working with unique constraints across multiple columns in knex pretty cumbersome due to inability to delete all of them them/check if they exist before redefining them. This leads to the need to remember what constraints have been defined before. This is why I propose adding uniqueConstraints method that will list all unique constraints. I'm more than willing to implement this feature for some dialects(oracledb is not working on my machine).

Niikelion commented 12 months ago

Figured out how to make oracledb work. Now I probably can implement it for every dialect.

Niikelion commented 12 months ago

I managed to implement this method for every dialect. If you decide to not include this feature in knex-schema-inspector full implementation will still be on my fork.

mdartic commented 1 month ago

Maybe this could be proposed to @directus/schema package ? (fork maintained by directus team) see https://github.com/directus/directus/tree/main/packages/schema