amberframework / granite

ORM Model with Adapters for mysql, pg, sqlite in the Crystal Language.
MIT License
296 stars 87 forks source link

Use Crystal type inference to find the correct adapter. #502

Closed hugopl closed 8 months ago

hugopl commented 8 months ago

Thinking again... Maybe this PR isn't good because it will make projects depend on all database backend shards. Not sure if it's already the case, but I believe people that just uses postgres don't need to have sqlite shard as dependency.

Blacksmoke16 commented 8 months ago

There's probably a way you could generate the case at compile time based on if those types exist. But debatable if that's worth the effort/complexity.

hugopl commented 8 months ago

~I took a look in the code and seems it's the case, Granite is requiring all kind of database client shards to compile, I'll open an issue for that.~

In fact Granite is fine, Amber is the one requiring all kind of databases as dependencies.