Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cakephp/database an optional dependency #1754

Open
MasterOdin opened this issue Apr 24, 2020 · 5 comments
Open

Make cakephp/database an optional dependency #1754

MasterOdin opened this issue Apr 24, 2020 · 5 comments

Comments

@MasterOdin
Copy link
Member

MasterOdin commented Apr 24, 2020

After looking at/doing #1753, I wondered if it would be possible to also make it so that there was not an explicit dependency on cakephp/database (which would in-turn solve #1647), and even potentially offering alternatives to it if someone so wanted.

The only thing that phinx relies on that library is to provide support for the getQueryBuilder() (AbstarctMigration) -> getQueryBuilder (Adapter) -> getDecoratedConnection (Adapter) -> cakephp/database. If it was made optional, this method would just raise an exception if cakephp/database does not exist, else operate as it does currently. I think this gives the best of all worlds here in that the overall installation cost of phinx is lowered, it does not pollute any namespace by default, and for those who want the query builder can use cakephp/database. For my own part, I do not use it in any of my projects as the few queries are simple enough to operate on all adapters as is).

Finally, it might make sense to specify an additional option of a query builder such as https://github.com/shadowhand/latitude, though make it clear that cakephp/database is the favored suggestion in docs and such.

@dereuromark
Copy link
Member

We just removed the collection package as dependency, but I don't think it is feasible to drop the main ORM layer here at this point.

@othercorey
Copy link
Member

othercorey commented Aug 4, 2020

I dont think removing the dependency is a useful goal. If phinx stays under cake, it is probably best long-term to make it use the cake db connection.

@PabloKowalczyk
Copy link

Dependency tree for cakephp/database v5 is even bigger than before, so it will make sense to make cakephp/database optional dependency. Are there any objections to do this?

For users searching for temporary workaround, add replace cakephp/database in composer.json:

{
    "require": {
        "robmorgan/phinx": "^2.0.2",
    }
    "replace": {
        "cakephp/database": "*",
    }
}

@dereuromark
Copy link
Member

dereuromark commented Oct 8, 2023

Note: If cakephp/migrations#647 gets traction, then this is actually very likely going to be possible.
Just wanted to cross-link this for reference.

@ajiho
Copy link

ajiho commented Oct 11, 2023

I want to keep Phinx as little dependency as possible, so that I can run it in any framework without having to worry about so many compatibility issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants