-
Notifications
You must be signed in to change notification settings - Fork 3
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
Added support for foreign key and unique constraints #1
Conversation
Added support for foreign key and unique constraints
Hey. Thanks. I must admit this project is quite abandoned. 5 yo without any change, without any test coverage I hope that it still works :) |
Hey Gonzalo, Thanks form merging. Actually I tested several “state of the art” database migration tools for PHP (phinx, ruckusing/migrations, CakeDC/Migrations) and decided, yours works the best for my purpose ;-) I think during the next days I’m still going to commit some optimizations. I’d also like to publish it as a composer package. Do you have any reservations about that or do you want to do that? Cheers, |
I'll create composer package today or maybe tomorrow. Nowadays I always add composer and at least a few integration test to projects. But 5 years not ago (good excuse, isn't it? :) Here maybe I need to create also too a travis.ci integration with a fake database for testing (as far as I remember Travis allows to us postgresql). I will try not to touch library to allow to merge your commits without problems. Also maybe you can have a look to a friend's library https://github.com/ojoven/mirendb. It's something similar but with a different scope |
Hey Gonzalo, Thats great news! I'll test the composer integration tomorrow. And for the cli: yeah, its not super beautyful, but most people (at least me) are going to set it up once in their CI tools. I'm going to write a rocketeer task for that. For the code conventions: I used psr2, but psr4 is fine with me. So let's get rid of the tabs ;-) I have a few new changes (linking of auto increment sequences for primary keys, complete constraint creation on table creation) almost done. I'm probably going to commit them tomorrow. |
New branch is called v2. It also has a simple set of tests. The library code is unchanged (with the same bugs). There's only a small change in folder structure (due to PSR-4). If it's ok for you I can merge branch |
Thats perfectly fine with me. I couldn't take the time today to test my newest changes, so I'll probably commit them next week. |
Ok I will merge the branch to master |
I pushed some new input. Unfortunately I couldn't come up with a perfect solution for foreign key creation on initial structure creation, since related tables may not yet exist. I introduced a new cli parameter -k to skip foreign key creation manually, but this is far from a great solution. Another option would be to run process the foreign keys after all other scipts. Another question: Is there a reason, why you removed the executable php script "pgdbsync" / "cli"? |
I've moved pgdbsync to bin dir and my default .gitignore excludes this folder (fixed) -k parameter sounds fuzzy maybe is better not to create fk (show a warning) first time and do it in the second time. Now is more easy to test the problem. Unit test with database normally are nightmare but the tests I've create are very simple and allow detect bugs. Can you create a failing test to show this issue. In fact the library is far from being perfect. I've realised various problems that slow down the development process:
I'll try to find time to create more tests, anyway |
No description provided.