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
Us of different migrations dirs #40
Comments
Currently this is not available. It does raise the question: during the generation process where it write the file to? The first entry in the array of directories? |
Maybe an optional option in the config with an array of path to read from (and use the existing option to read from and write the files during the generation process) |
Is that "optional option" must belongs to each database or you want just array declaration for 'migrations_dir' option? |
I prefer an array declaration for the migrations_dir option. |
Check it. What if it will be a key-array like this one: array ("main" => %ordinary_path%, "foo" => %another_path% ... )? |
Oh, forget second part. And you could generate migrations in selected dir by corresponding param in CLI like, for instance, 'path=foo'. |
That key array sounds like a good solution. |
After reading the comment I still could not get what the end result of this would be. Some real command use cases with examples could be appreciated. What are the keys of the array ? |
No problem. Known use-cases:
Feel free to correct me if i made mistake. Real command at this moment: php ruckus.php db:create [env=production] [dir=foo] |
Ok guys, i did it. But there is some points.
Will answer any questions through 12 hours. |
The thing I don't understand is why do you want multiple directories for migrations. A migration directory is related to a database. if you have multiple databases, then you need multiple environment. As of now migrations are structured based on the database. So different databases migrations are placed in different directories named according to the database name. With this change the migrations of a particular database would be scattered over multiples folders. Does Thanks |
This question need to address to tvbeek. I'm just implement it. |
When you use modules in a project you want to have the database changes in a module and not in the project. Because you can reuse the module and don't want to need to copy the migration files. Like a simple project structure /www /modules /base /migations /auth /migrations /cms /migrations /ruckusing-migrations You have one directory with ruckusing-migrations. And multiple directories with migrations for the same database. |
@tvbeek I think I now understand a little bit your problem. I think a good solution would have to be carefully thought so as to not break so many things. @tonkonogov pr is a good start but I'm pretty sure it's breaking something somewhere still not tested. I will think about it carefully and push some codes around the end of this week basing off #76 . And this will badly need some good test cases. |
I tested locally migrating and generating migrations with old config file as well as config file with 2 dirs. Still doesn't tested any other tasks. |
@tvbeek please checkout the new branch ```git clone -b module-migration-dir https://github.com/ruckus/ruckusing-migrations.git ruckusing-migrations-test/` |
I forgot to mention the new command: php ruckus.php db:generate create_users_table module=cms
php ruckus.php db:migrate of course your migration_dir would be like I'm working on an update for the test cases that will gives us more test coverage. So if @tonkonogov sends a pr for the unit tests, I will just merge them. If not, when I'm done with that "tests-branch", it will cover this change |
After 5 months of bad things I have finally returned to my promise about tests. I didn't forget %) |
@tonkonogov I've merged your changes. Thanks a lot |
Is there a possibility to add multiple directory's to read the migrations?
I want this to set the migrations in the module (a git submodule)
but run the migrations from the base project.
The text was updated successfully, but these errors were encountered: