-
Notifications
You must be signed in to change notification settings - Fork 4
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
Official Laravel integration? #1
Comments
We would love if you can create a Laravel integration for Upscheme to be used as alternative to Laravel migrations :-) |
Bonus question: I also wrote a schema generator that creates migration files based on existing tables, is this something you are interested in as well? Again, I will likely not support it for anything beyond what I personally use but I can create a separate repository for it which can hopefully be expanded upon by others! |
See the code in https://github.com/MichelJonkman/laravel-declarative-schema for how I've currently done it. Note that this was made pretty quickly so the code quality isn't very good. A key feature of it though, is that normal migrations continue to work, meaning that packages that include migrations keep working. |
Guess, the best place to generate the schema definition would be as part of Upscheme because then we can leverage the Doctrine DBAL objects. I can imagine adding methods like |
Could you elaborate about what you mean with that? |
To generate schema migration files, you need a representation of the tables, column, views, etc. Currently, you use DBAL directly to get that representation but if you use Upscheme, it makes more sense to retrieve that information from Upscheme directly and in a representation which is better suited and easier to handle. |
Oh yes of course, I'll have to figure that all out when I go to work on it. I'm currently quite busy with other things but my own package will probably break due to updates soon so when I have some extra time I'll work on these things. Thank you very much for making this package btw! It's a shame that this approach is not utilized more often, my feature request for Laravel also got very little traction... Is there an Aimeos Discord server I can join for better communication? |
Unfortunately not. Laravel maintainers seem to get very conservative and mainly want to use own ideas and code. |
I have exactly the same experience, I had a lot of trouble trying to inject my custom migrator into the |
Based on your feedback, we've implemented a $config = [
'db' => [
'driver' => 'pdo_mysql',
'host' => '127.0.0.1',
'dbname' => '<database>',
'user' => '<dbuser>',
'password' => '<secret>'
]
];
\Aimeos\Upscheme\Up::use( $config, 'migrations' )->create(); This will generate one file for each sequence, table and view in the passed $config = [
'db' => [
'driver' => 'pdo_mysql',
// ...
],
'order' => [
'driver' => 'pdo_oci',
// ...
]
];
\Aimeos\Upscheme\Up::use( $config, 'migrations' )->create( ['db', 'order'] ); |
I had a quick look at the
While I haven't tested the package very well yet, so far all my issues were relatively minor like the previous feedback and I'm very happy with that! Not having the stress of having to figure out and manage the hardest part of the package is absolutely great so thank you very much for creating and maintaining this. I asked earlier as well, but is there a Discord server or other social media platform where it's easier to discuss things in the future? If GitHub is preferred then that's okay but I feel like it will slow down communication a lot when it's only about small things or ideas. |
Sure, we appreciate any improvments :-)
At the moment, the migrations are setting all non-empty values. It's subject to more investigations if this can be reduced. The
Good point. It should be relatively easy to adapt that.
There are some differences and you won't get a Laravel-like API without adding alias methods.
We don't think it's possible to get a list of changed tables but a
This is problematic for several reasons:
Github issues are a great way for us to document decisions so we prefer them even if communication may be slightly slower :-) |
The generated migration files should now be PSR-2 compliant: a7641b0 |
I don't have much experience with managing packages so I have quite a lot to learn but apart from a Laravel integration I'm also thinking of creating a Symfony/Console version with batteries included, this would mostly be for myself but maybe it could also help drive adoption for the package. |
There might be a better way as Upscheme supports macros like Laravel does. You can simple add methods to the existing table or column class using: \Aimeos\Upscheme\Schema\Column::macro('nullable', function($val) {
return $this->null(true);
});
More integrations into existing frameworks would be great! :-) |
Hey there, I made a similar package though it's not nearly as stable and well maintained as this package. I was just wondering whether there is any official Laravel integration, or if it's planned? Ideally it would include an API that works mostly like Laravel since that would make migrating to Upscheme from Laravel migrations or my own package very easy. If not I will probably do so myself but I don't have the capacity to maintain it for other users.
The text was updated successfully, but these errors were encountered: