jazzyb / sqlite_ecto

SQLite3 adapter for Ecto
MIT License
77 stars 27 forks source link

Can't use sqlite_ecto with latest Phoenix framework #47

Open markokocic opened 8 years ago

markokocic commented 8 years ago

sqlite_ecto doesn't work with latest ecto version shipped with Phoenix Framework 1.3 due to dependency resolution problems.

sprobstCocus commented 8 years ago

Looking at the ecto project, it claims that sqlite_ecto is not compatible with ecto 2.0. phoenix_ecto needs ecto version 2.0.0-rc, while sqlite_ecto requires version 1.1. I don't know how hard it is to update sqlite_ecto to support the latest version of ecto .

HughGrant commented 8 years ago

same problem here. not just ecto2, but also with posion2.

hayesgm commented 7 years ago

Does this project have a plan or roadmap to support Ecto 2.0? It's like a hard requirement for long-term use of this project.

kentor commented 7 years ago

Hmm yeah.. this is really hurting adoption / learning of ecto/phoenix. Not really interested in setting up an SQL server for testing purposes.

philipgiuliani commented 7 years ago

Yeah and for nerves-project :( Dont want to install any DB on embedded.

hayesgm commented 7 years ago

How much effort will be it to make this project Ecto 2.0 compatible? Probably worth the effort to tag out the work effort and just move on it. I think this is too important to just ignore.

gallexme commented 7 years ago

any updates?

obmarg commented 7 years ago

I have been working on adding ecto 2 support over the weekend. Got the basics working already, just need to fix a bunch of integration tests. Hope to have a PR ready in the next few days.

philipgiuliani commented 7 years ago

Thank you very much for your work @obmarg! You already have it on git so i can try it out?

obmarg commented 7 years ago

@philipgiuliani I've pushed up a WIP commit to the feature/ecto-2.0 branch of my fork: https://github.com/obmarg/sqlite_ecto/tree/feature/ecto-2.0

I can't guarantee it's particularly usable right now: the project I've been testing it against has fairly minimal usage of ecto, and the integration tests are failing before they even start. Feel free to give it a try though.

alakra commented 7 years ago

@jazzyb any thoughts on this?

philipgiuliani commented 7 years ago

@obmarg Could you also update Poison to 2.0? The sqlite_ecto requires ~> 1.0.0 and my project requires ~> 2.0.0. Ecto itself requires ~> 1.5 or ~2.0.

So far it seems to work fine. I have tested to create migrations, migrate and insert/read data from tables. But without associations yet.

I also noticed that :sqlitex, :db_connection have to be added in applications. Otherwise exrm will not add them to the release.

fishcakez commented 7 years ago

I think to use SQLite with Ecto 2 we will need to switch to a port_driver based API, instead of NIF because DBConnection is designed around multi process port access and wants to be able to close the the "connection" while another process is running a query and to close the "connection" when the DBConnection process exits. This would mean replacing sqlitex with a different SQLite implementation.

https://github.com/alexeyr/erlang-sqlite3 seems like a reasonable candidate. Likely we would want to fork it and replace rebar with mix, and the Erlang code with Elixir.

obmarg commented 7 years ago

@fishcakez I'm not sure I follow, how does Sqlitex being implemented with NIFs prevent DBConnection from closing "connections"?

I've got an incomplete DBConnection implementation for Sqlitex, is there something obvious I'm missing in there?

fishcakez commented 7 years ago

@obmarg I am concerned about the Ecto 2.0 style timeouts and error handling. Ecto 2.0 timeouts require the "connection" to be closed by DBConnection while the caller is running queries, which interrupts the caller. I am unsure how that can be achieved with a NIF. In the code you linked it looks like this doesn't happen but please correct me if I am wrong. With a port_driver we can close the port. With Ecto 2.0 timeouts are per ownership and per transaction - different to Ecto 1.0.