Comments (19)
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?
from ruckusing-migrations.
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)
from ruckusing-migrations.
Is that "optional option" must belongs to each database or you want just array declaration for 'migrations_dir' option?
from ruckusing-migrations.
I prefer an array declaration for the migrations_dir option.
from ruckusing-migrations.
Check it. What if it will be a key-array like this one: array ("main" => %ordinary_path%, "foo" => %another_path% ... )?
And for convenience and reverse compatibility this option still should accept ordinary string with path without any array declaration.
Is it suitable?
from ruckusing-migrations.
Oh, forget second part. And you could generate migrations in selected dir by corresponding param in CLI like, for instance, 'path=foo'.
from ruckusing-migrations.
That key array sounds like a good solution.
from ruckusing-migrations.
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 ?
Thanks
from ruckusing-migrations.
No problem.
Keys of the array - just some name for specify pathes. Now I'm use it in error message by migration similarity.
User can specify 'migrations_dir' as well as ordinary string (default state).
Known use-cases:
- Creating migration
1.1 User with default state - just will get processing for the only folder. If user sets 'dir' param - just pass it without error.
1.2 User with array in 'migrations_dir':
1.2.1 User specified 'dir' param at script running - I use this param as destination, but will check all folders for unique migration name. If there is no path in 'migrations_dir' with such param as name - config error
1.2.2 User doesn't specified 'dir' param at script running - I use the first key from 'migrations_dir' as destination, but will check all folders for unique migration name. If there is no path in 'migrations_dir' with such param as name - config error - Migrate - will form common list of tasks from all dirs from 'migrations_dir' and migrate by this list.
Feel free to correct me if i made mistake.
Real command at this moment: php ruckus.php db:create [env=production] [dir=foo]
db:migrate command without changes.
from ruckusing-migrations.
Ok guys, i did it. But there is some points.
- Review my code as critical as you can
- I. Just. Can't. Create. Any. Test. It's my weakest part.
Will answer any questions through 12 hours.
from ruckusing-migrations.
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 rake
works like this ? It's like this will add complexity with no obvious benefit.
Thanks
from ruckusing-migrations.
This question need to address to tvbeek. I'm just implement it.
Аlternatively - you will decline my pull request and tvbeek could use my branch for this feature.
BTW, agree with you about "complexity with no obvious benefit".
from ruckusing-migrations.
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.
from ruckusing-migrations.
@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.
Thanks
from ruckusing-migrations.
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.
I'll try to create unit tests for this feature at nearest weekend.
from ruckusing-migrations.
@tvbeek please checkout the new branch module-migration-dir
to see if it solves your problem without any error.
```git clone -b module-migration-dir https://github.com/ruckus/ruckusing-migrations.git ruckusing-migrations-test/`
from ruckusing-migrations.
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 'migration_dir' => array('default' => '/default/path/migrations', 'cms' => '/path/to/cms/migrations')
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
from ruckusing-migrations.
After 5 months of bad things I have finally returned to my promise about tests. I didn't forget %)
from ruckusing-migrations.
@tonkonogov I've merged your changes. Thanks a lot
from ruckusing-migrations.
Related Issues (20)
- Run migration through code HOT 1
- db:migrate throws exception if migrations dir is not writable HOT 3
- migrate_from_offset issue HOT 1
- Unable to execute query for trigger HOT 10
- DB connection issue when trying to setup Ruckusing Migrations - Abstract.php No Such File Or Directory HOT 4
- Error during migrations and rollbacks. "Reason: Commands out of sync; you can't run this command now" HOT 3
- Is it possible to execute the ruckusing-migration through http request HOT 4
- Is there any plan to have more details in schema_migrations table? HOT 1
- MySQL timestamp needs a NULL attribute when null == true
- how can i add auto_increment column to work with mysql and postgres databases? HOT 5
- FOREIGN KEY Constraint HOT 1
- Exception not properly thrown HOT 1
- Documentation for config file HOT 1
- CREATE INDEX CONCURRENTLY cannot run inside a transaction block
- Fatal error: Class 'mysqli' not found in /web/vendor/ruckusing/ruckusing-migrations/lib/Ruckusing/Adapter/MySQL/Base.php on line 1259 HOT 3
- Error:I dont know what column type of 'longtext' maps to for MySQL
- Roadmap: Integrate Percona Toolkit? HOT 1
- Use PSR LoggerInterface instead of Ruckusing_Util_Logger.
- Unable to connect via TLS for MySQL connections
- too many connections
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruckusing-migrations.