# |
Jul 18th 2017, 15:25 |
cleptric |
mic_ How big is your app? |
# |
Jul 18th 2017, 15:25 |
sonu-nk |
yes.. :) |
# |
Jul 18th 2017, 15:25 |
mic_ |
did anybody here upgrade from 1.2/1.3 to 2.x or 3.x? What would be the best strategy? (I want 1.2 -> 1.3 -> 2.10 and then decide whether to axe/start from scratch) |
# |
Jul 18th 2017, 15:24 |
cleptric |
Ok, then use the feature I mentioned above your question :slightly_smiling_face: |
# |
Jul 18th 2017, 15:24 |
sonu-nk |
suppose i want to shift my project on another host. now i cant install database there. but i want a command which can generate migration files for me.. so that i can run same migration file on another server and my datbase ready |
# |
Jul 18th 2017, 15:24 |
cleptric |
If so, use this https://book.cakephp.org/3.0/en/migrations.html#generating-migrations-from-an-existing-database |
# |
Jul 18th 2017, 15:23 |
cleptric |
Like an Initial migration? |
# |
Jul 18th 2017, 15:23 |
cleptric |
You want a migration that contains the whole database? |
# |
Jul 18th 2017, 15:22 |
cleptric |
What do you want to do exactly? :slightly_smiling_face: |
# |
Jul 18th 2017, 15:22 |
sonu-nk |
@cleptric https://book.cakephp.org/3.0/en/migrations.html#syntax i also saw that one.. but that one require to add table fields and datatype as command arguments |
# |
Jul 18th 2017, 15:22 |
jeremyharris |
though I’m not sure that’d be the best idea :slightly_smiling_face: |
# |
Jul 18th 2017, 15:22 |
genellern |
https://book.cakephp.org/3.0/en/migrations.html#dump-generating-a-dump-file-for-the-diff-baking-feature |
# |
Jul 18th 2017, 15:22 |
jeremyharris |
I could be wrong, but I think you can also stopPropagation and return a string which would set the “result” |
# |
Jul 18th 2017, 15:21 |
jeremyharris |
awi it’s not pretty, but you can add a public property to event, like $event->message = ‘message’; $event->stopPropagation(); or, you can add it to the event data |
# |
Jul 18th 2017, 15:21 |
cleptric |
https://book.cakephp.org/3.0/en/migrations.html#creating-migrations |
# |
Jul 18th 2017, 15:20 |
cleptric |
One second :slightly_smiling_face: |
# |
Jul 18th 2017, 15:20 |
sonu-nk |
@cleptric the same i did not find... i was looking at book... |
# |
Jul 18th 2017, 15:20 |
cleptric |
sonu-nk bake offers some stuff |
# |
Jul 18th 2017, 15:19 |
sonu-nk |
@genellern i am looking for the command or anything which can help me to generate migration files from my database table |
# |
Jul 18th 2017, 15:18 |
awi |
When I stop it, it will fail in the controller? |
# |
Jul 18th 2017, 15:18 |
awi |
ok... |
# |
Jul 18th 2017, 15:18 |
cleptric |
Sorry, i don’t know any elegant way to behonest |
# |
Jul 18th 2017, 15:18 |
cleptric |
Uhhh :thinking_face: |
# |
Jul 18th 2017, 15:17 |
awi |
can I somehow set a message when i use stoppropagation? |
# |
Jul 18th 2017, 15:16 |
genellern |
sonu-nk look at the dump option in the migrations plugin |
# |
Jul 18th 2017, 15:15 |
cleptric |
if you call `$event->stopPropagation()` this will stop the delete opration |
# |
Jul 18th 2017, 15:15 |
cleptric |
beforeDelete has a `$event` parameter |
# |
Jul 18th 2017, 15:14 |
awi |
or something like an return? |
# |
Jul 18th 2017, 15:14 |
awi |
What do you mean exactly by "By stopping this event you will abort the delete operation." in https://book.cakephp.org/3.0/en/orm/table-objects.html#beforedelete ? Something like exit;? |
# |
Jul 18th 2017, 15:13 |
sonu-nk |
? |
# |
Jul 18th 2017, 15:13 |
sonu-nk |
is there any command in cakephp3 which can generate migration file from database |
# |
Jul 18th 2017, 15:12 |
neon1024 |
What about the datasource for the fixture to write to the datastore? |
# |
Jul 18th 2017, 15:12 |
admad |
No other setup code |
# |
Jul 18th 2017, 15:12 |
admad |
Just include core fixture anf TR::get() to get table instance |
# |
Jul 18th 2017, 15:11 |
admad |
It's that easy to test a behaviour https://github.com/UseMuffin/Orderly/blob/master/tests/TestCase/Model/Behavior/OrderlyBehaviorTest.php |
# |
Jul 18th 2017, 15:10 |
jeremyharris |
the above is what I do for my behaviors that don’t interact with fixture data |
# |
Jul 18th 2017, 15:09 |
neon1024 |
Perhaps I should check the core ORM tests instead of the core behaviour tests |
# |
Jul 18th 2017, 15:09 |
jeremyharris |
``` $this->Table = new Table([ ‘alias’ => ‘Contacts’, ‘connection’ => ConnectionManager::get(‘test’), ]); $this->Table->addBehavior(‘DateConverter’, [ ‘fields’ => [ ‘date’ ] ]); $this->Table->schema()->addColumn(‘date’, [‘type’ => ‘datetime’]); |
# |
Jul 18th 2017, 15:09 |
jeremyharris |
you can create a dummy table |
# |
Jul 18th 2017, 15:09 |
neon1024 |
Then table takes schema, and urgh |
# |
Jul 18th 2017, 15:09 |
neon1024 |
But query takes connection and table |