-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add initial support for generating seed files #179
Conversation
Looks like a good start to me. While baking a seed file, maybe it would a nice feature to ask if the current table data are to be exported as records ? Or with an option ? |
Exporting table data to re-usable records/arrays would be a godsent by itself 👍 |
* | ||
* @var string | ||
*/ | ||
public $pathFragment = 'Seed/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
. DS? Screw PHP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't do that in a class attribute. Also, all other bake tasks use slashes, and php now correctly handles them afaik.
I like it. It did always trouble me how to pre-populate some basic data like say admin account or genders table. |
Semi-related, https://gist.github.com/josegonzalez/3863f341ede1b6273ba3 @bravo-kernel take a look, might be... interesting :) |
Thanks for the pointer @josegonzalez. Exporting data so it can be re-entered cake-style (e.g. column order dependent) is what I think would complete my migrations workflow:
|
I think this is a good start, since you are an awesome writer @josegonzalez, do you mind adding a few lines in the book about using this feature? |
Add initial support for generating seed files
It's not done yet, in that there isn't a way to actually use the seed files. That still needs to be done. @HavokInspiration I think you are more familiar with futzing with phinx commands, mind taking care of that? I might have time this weekend otherwise. |
Ah, I thought it was in a kind of usable state already :( |
You definitely need to read the code/comments in my PRs, otherwise we're going to have issues where I break cake core :P |
@josegonzalez I forgot that seeds where something different to migrations, so I thought just having the file generated would be enough :D |
@josegonzalez I'm not sure if I'll get the time before this weekend, but I can start looking into it. |
I gave this a spin. I still have some tuning to do to the Bake task (and maybe some cleanup). And add tests. |
Wait, we still can't put phinx files into namespaced directories? |
Nop. |
Gotcha. Welp thems the breaks. |
This is part one of the necessary work to add support for phinx seeds. Our next step is to add support to the migrations runners to actually apply seeds to a database.
Opening PR to continue discussion based on running code :)
Refs #19.