# |
Jul 12th 2018, 15:24 |
okelet |
i will try with a migration, unmarking every time i run it |
# |
Jul 12th 2018, 15:24 |
okelet |
yes, i know, i have some migrations |
# |
Jul 12th 2018, 15:23 |
josbeir |
check out phinx docs |
# |
Jul 12th 2018, 15:23 |
josbeir |
you have $this->hasTable('table'); $table->hasColumn('column'); etc.. |
# |
Jul 12th 2018, 15:21 |
josbeir |
you have methods like exists() etc |
# |
Jul 12th 2018, 15:21 |
josbeir |
it should work ok |
# |
Jul 12th 2018, 15:21 |
josbeir |
that has extra checks in the up/down functions |
# |
Jul 12th 2018, 15:21 |
josbeir |
but still, all of your logic can be inside a migration class |
# |
Jul 12th 2018, 15:20 |
okelet |
ah ok ok |
# |
Jul 12th 2018, 15:20 |
josbeir |
bin/cake migrations rollback |
# |
Jul 12th 2018, 15:20 |
josbeir |
well you can rollback |
# |
Jul 12th 2018, 15:20 |
josbeir |
i dont think you can run migrations classes from a command, you can probably call the migration shell |
# |
Jul 12th 2018, 15:19 |
okelet |
can I unmark a migration from cmd? |
# |
Jul 12th 2018, 15:18 |
okelet |
also, if i would create a migrations every time I found a problem, i would end up with lots of migrations, that, at the end, are rubbish |
# |
Jul 12th 2018, 15:18 |
josbeir |
you can just unmark it |
# |
Jul 12th 2018, 15:18 |
okelet |
i would like to modify the command while I find schema problems, and run it again, with migrations, the migration would be marked as migrated and wouldn't run again |
# |
Jul 12th 2018, 15:15 |
josbeir |
why dont you write your checking stuff in the migration itself? |
# |
Jul 12th 2018, 15:12 |
okelet |
hi, is possible to use migrations inside a command? We have a lot of not-synced schema databases, and I need to write a command to check for columns, indexes, etc. I have tried with ConnectionManager::get('default')->getSchemaCollection()->describe('my_table') but it has no methods to removeIndex, or save like migration has... Thanks! |
# |
Jul 12th 2018, 14:53 |
josbeir |
on does not simply underestimate cake utilities |
# |
Jul 12th 2018, 14:52 |
neon1024 |
:ok_hand: |
# |
Jul 12th 2018, 14:49 |
josbeir |
maybe something like that |
# |
Jul 12th 2018, 14:49 |
josbeir |
Inflector::humanize(Inflector::underscore($string)) |
# |
Jul 12th 2018, 14:49 |
josbeir |
Inflector::humanize() |
# |
Jul 12th 2018, 14:48 |
neon1024 |
Or something like `^([\w])(.*)([A-Z])(.*)` |
# |
Jul 12th 2018, 14:47 |
neon1024 |
Is there a neat way to transform `camelCase` into `Camel Case` ? Closest I can get is using `Inflector::underscore` and then replacing `_` with ` ` and using `ucwords()`. Which is just.. well.. too much code |
# |
Jul 12th 2018, 14:46 |
josbeir |
@itmpls run bin/cake routes to see how your routes are seen by cake |
# |
Jul 12th 2018, 14:42 |
neon1024 |
`bin/cake console` <3 |
# |
Jul 12th 2018, 14:41 |
itmpls |
nevermind |
# |
Jul 12th 2018, 14:41 |
itmpls |
should first's action be different? |
# |
Jul 12th 2018, 14:41 |
itmpls |
first has index, second has unsubscribed |
# |
Jul 12th 2018, 14:41 |
itmpls |
the actions are different? |
# |
Jul 12th 2018, 14:30 |
verax5 |
Any help please |
# |
Jul 12th 2018, 14:20 |
verax5 |
Same controller |
# |
Jul 12th 2018, 14:20 |
verax5 |
https://kopy.io/p2oAL |
# |
Jul 12th 2018, 14:20 |
verax5 |
But this route works though? |
# |
Jul 12th 2018, 14:20 |
verax5 |
slackebot4: |
# |
Jul 12th 2018, 14:18 |
lubos |
@admad true, good idea :slightly_smiling_face: thanks |
# |
Jul 12th 2018, 14:18 |
itmpls |
not sure how flexible |
# |
Jul 12th 2018, 14:18 |
admad |
@lubos can just use 'error' => false |
# |
Jul 12th 2018, 14:18 |
itmpls |
verax5 - shouldn't it be capitalized/camelcased, the filename of your controller? |
# |
Jul 12th 2018, 14:16 |
lubos |
should I unset error in entity? |