# |
Jul 13th 2021, 20:40 |
kevin.pfeifer |
would be a nice addition to https://book.cakephp.org/migrations/2/en/index.html |
# |
Jul 13th 2021, 20:39 |
greg138 |
I don't know if it's in the docs. It's in my code, but it might have gotten there by me searching the source, not the docs. :) |
# |
Jul 13th 2021, 20:20 |
dereuromark |
if this isnt in the docs, maybe it should be :) |
# |
Jul 13th 2021, 19:11 |
greg138 |
`$migrations = new \Migrations\Migrations();` `$migrations->seed(['plugin' => 'MyPlugin', 'seed' => 'MySeed']);` |
# |
Jul 13th 2021, 19:05 |
richard |
makes my life easier |
# |
Jul 13th 2021, 19:05 |
richard |
what i do is create a masterseed that runs all the other seeds, i also have checks in each seed so re-running won’t produce duplicate records |
# |
Jul 13th 2021, 18:28 |
devito |
is it possible to change the default layout of a plugin without modifying the plugin its self? |
# |
Jul 13th 2021, 17:48 |
tyler.adam.lazenby |
yeah |
# |
Jul 13th 2021, 17:48 |
dereuromark |
genius :) I would probably still prefer to have also a more code native way to run them. Might be worth a PR some day for someone. |
# |
Jul 13th 2021, 17:47 |
tyler.adam.lazenby |
```public function runSeed($name) { exec(join(DS, ['bin', 'cake']) . " migrations seed --seed=$name"); }``` |
# |
Jul 13th 2021, 17:47 |
tyler.adam.lazenby |
for me this works fine |
# |
Jul 13th 2021, 17:34 |
tyler.adam.lazenby |
if this doesn't work |
# |
Jul 13th 2021, 17:34 |
tyler.adam.lazenby |
i might |
# |
Jul 13th 2021, 17:34 |
tyler.adam.lazenby |
hmmmmm |
# |
Jul 13th 2021, 17:33 |
kevin.pfeifer |
You could try to get some code snippets from https://github.com/cakephp/migrations/blob/master/src/AbstractSeed.php#L72 Which basically is the function to call one seed inside of another |
# |
Jul 13th 2021, 17:30 |
tyler.adam.lazenby |
nevermind |
# |
Jul 13th 2021, 17:30 |
tyler.adam.lazenby |
oh wait |
# |
Jul 13th 2021, 17:30 |
tyler.adam.lazenby |
and I can't call DS here |
# |
Jul 13th 2021, 17:29 |
tyler.adam.lazenby |
and the \ should be \ in windows but it should / on linux |
# |
Jul 13th 2021, 17:29 |
tyler.adam.lazenby |
the problem with that is that I am developing on windows for a machine that is in linux |
# |
Jul 13th 2021, 17:29 |
tyler.adam.lazenby |
the hax way huh? |
# |
Jul 13th 2021, 17:28 |
dereuromark |
exec() :P |
# |
Jul 13th 2021, 17:25 |
tyler.adam.lazenby |
is there a way to call seeds within a migration? |
# |
Jul 13th 2021, 16:38 |
kevin.pfeifer |
sometimes they work pretty well :) |
# |
Jul 13th 2021, 16:37 |
tyler.adam.lazenby |
You got gifs to work huh? |
# |
Jul 13th 2021, 16:35 |
kevin.pfeifer |
calm down |
# |
Jul 13th 2021, 16:31 |
tyler.adam.lazenby |
HistoryTypesSeed and MessageTypesSeed |
# |
Jul 13th 2021, 16:31 |
tyler.adam.lazenby |
I was running two different seeds and didn't even realize |
# |
Jul 13th 2021, 16:31 |
tyler.adam.lazenby |
Nevermind guys |
# |
Jul 13th 2021, 16:29 |
tyler.adam.lazenby |
it does that |
# |
Jul 13th 2021, 16:28 |
tyler.adam.lazenby |
even if I truncate it |
# |
Jul 13th 2021, 16:25 |
tyler.adam.lazenby |
yes |
# |
Jul 13th 2021, 16:25 |
kevin.pfeifer |
does your `id` column have a `AUTO_INCREMENT` on it? |
# |
Jul 13th 2021, 16:23 |
tyler.adam.lazenby |
if I remove the duplicate |
# |
Jul 13th 2021, 16:23 |
tyler.adam.lazenby |
the email is duplicated yes but the seed still fails |
# |
Jul 13th 2021, 16:23 |
tyler.adam.lazenby |
nevermind |
# |
Jul 13th 2021, 16:23 |
tyler.adam.lazenby |
goddamnit |
# |
Jul 13th 2021, 16:23 |
tyler.adam.lazenby |
oh wait |
# |
Jul 13th 2021, 16:22 |
tyler.adam.lazenby |
```$data = [ [ 'name' => 'Email', 'description' => 'Emails sent to contact', ], [ 'name' => 'Text', 'description' => 'Texts sent to contact', ], [ 'name' => 'Other', 'description' => 'Other histories', ], [ 'name' => 'Email', 'description' => 'Email sent to contact', ] ];``` |
# |
Jul 13th 2021, 16:22 |
tyler.adam.lazenby |
But my seed doesn't even reference the primary key |
# |
Jul 13th 2021, 16:22 |
tyler.adam.lazenby |
Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY' in C:\Users\TylerLazenby\Documents\ezBusinessManager2\vendor\robmorgan\phinx\src\Phinx\Db\Adapte r\PdoAdapter.php on line 339 |