SoftwareBrothers / adminjs

AdminJS is an admin panel for apps written in node.js
https://adminjs.co
MIT License
8.23k stars 663 forks source link

Support for Knex.js #940

Closed mlevit closed 1 year ago

mlevit commented 3 years ago

Describe the problem feature solves Support for https://knexjs.org/ on top of Sequilize and TypeORM. https://bookshelfjs.org/ runs on top of Knex and provides ORM capabilities.

Describe the solution you'd like Ability to use models created using Knex.

Describe alternatives you've considered Nothing else.

Acceptance criteria Ability to point AdminBro at Knex models to create admin console.

damusix commented 2 years ago

You should probably throw ObjectionJS in there along with it. It's widely used in the HapiJS space.

damian-pastorini commented 2 years ago

Maybe this is useful for you, I've made my own resource for ObjectionJS / Knex, mine is pretty simple and obviously could be improved but it works perfectly:

https://github.com/damian-pastorini/reldens/tree/37abbc8ddde86e5b515ad1570ff0900243663a39/packages/admin/server

https://github.com/damian-pastorini/reldens/blob/37abbc8ddde86e5b515ad1570ff0900243663a39/packages/admin/server/objection-driver-resource.js

The version is not the latest because I also wanted to make my app accept multiple drivers so I've ended up with these: https://github.com/damian-pastorini/reldens-storage/tree/v0.10.0-beta.23/lib

wirekang commented 2 years ago

I made an adapter that doesn't need ORM. Check out adminjs-sql. It uses Knex and fetch schema from INFORMATION_SHCEMA.

dziraf commented 1 year ago

There's currently an adapter for Objection which uses Knex internally, there's also an unofficial adapter made by @wirekang for MySQL. I'll close this issue as Bookshelf's adapter is not planned to be implemented in near future.