# |
Jul 13th 2021, 16:22 |
tyler.adam.lazenby |
I am running seeds and I had to drop the data from the table so that I could reseed in test |
# |
Jul 13th 2021, 16:22 |
tyler.adam.lazenby |
I am also running into something else |
# |
Jul 13th 2021, 15:57 |
dereuromark |
based on the current activity just reporting might not get it fixed any time soon I would recommend a PR directly, if you want to have this rather sooner than later. |
# |
Jul 13th 2021, 15:54 |
tyler.adam.lazenby |
should I report that? |
# |
Jul 13th 2021, 15:50 |
dereuromark |
sounds like a bug then |
# |
Jul 13th 2021, 15:48 |
richard |
oh |
# |
Jul 13th 2021, 15:47 |
tyler.adam.lazenby |
`bin/cake bake migration_snapshot Initial` |
# |
Jul 13th 2021, 15:47 |
richard |
how exactly did you create it via the migrations plugin |
# |
Jul 13th 2021, 15:46 |
tyler.adam.lazenby |
but the first was actually created by the migrations plugin |
# |
Jul 13th 2021, 15:46 |
tyler.adam.lazenby |
```->addColumn('updated', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP', 'limit' => null, 'null' => false, ])``` |
# |
Jul 13th 2021, 15:46 |
tyler.adam.lazenby |
It will work if I mass change it to this |
# |
Jul 13th 2021, 15:45 |
tyler.adam.lazenby |
```->addColumn('updated', 'datetime', [ 'default' => 'current_timestamp()', 'limit' => null, 'null' => false, ])``` |
# |
Jul 13th 2021, 15:45 |
kevin.pfeifer |
I can’t find any valid php function which is called `current_timestamp()` Or do you mean the MySQL function? |
# |
Jul 13th 2021, 15:41 |
tyler.adam.lazenby |
Is there a reason why the default value for datetime `current_timestamp()` is (a) generated by the snapshot command in migrations and (b) the system considers that invalid? |
# |
Jul 13th 2021, 14:59 |
tyler.adam.lazenby |
gosh dang it, I have to use an app_local file |
# |
Jul 13th 2021, 14:57 |
richard |
tired of doing sudo mysql then creating dbs/etc |
# |
Jul 13th 2021, 14:57 |
richard |
I was thinking as some sort of dev ops chain but honestly i haven’t done that either, it’s something i want to start doing more often though |
# |
Jul 13th 2021, 14:56 |
tyler.adam.lazenby |
init script huh? I have never done one of those |
# |
Jul 13th 2021, 14:55 |
richard |
also might be weird, yeah, so you’re better off just doing that part yourself as some sort of init script or something |
# |
Jul 13th 2021, 14:55 |
tyler.adam.lazenby |
yeah, but the thing about that is... migrations rufuses to run if it can't find a database connection |
# |
Jul 13th 2021, 14:55 |
richard |
i don’t think there is a db-agnostic way to do it though |
# |
Jul 13th 2021, 14:54 |
richard |
@tyler.adam.lazenby you can run any query in a migration technically, so yeah |
# |
Jul 13th 2021, 14:45 |
tyler.adam.lazenby |
so question... can migrations be programed to create a db or do I need to do that manually |
# |
Jul 13th 2021, 13:46 |
erwane |
If data are encoded with default flags, you can change it after i think. toPhp decode all data (escaped or not) toDatabase recode them with flags. I'm hot sure this should add bug. BUT this should be an option in JsonType, not default. |
# |
Jul 13th 2021, 13:43 |
dereuromark |
yeah, as expected the impact is rather small. but none the less, sounds like a more consistent data storage if done with the right flags from the beginning. one should however not change those in the middle (if data already exists). |
# |
Jul 13th 2021, 13:42 |
erwane |
```decode 1119 escaped: 0.001491s decode 1663 unescaped: 0.001954s``` |
# |
Jul 13th 2021, 13:42 |
erwane |
After more tests, not sure there is a large impact on speed. |
# |
Jul 13th 2021, 13:38 |
erwane |
weird result :S |
# |
Jul 13th 2021, 13:38 |
erwane |
with true datas : ```decode 1663 unescaped: 0.005169s decode 1119 escaped: 0.002547s``` |
# |
Jul 13th 2021, 13:14 |
erwane |
on 10'000 iteration but input is not random. Maybe internal php cache do the job. ```encode default: 0.335539s encode unescaped: 0.341111s decode escaped json: 0.426201s decode unescaped json: 0.410178s``` |
# |
Jul 13th 2021, 13:08 |
val |
but that doesn't work |
# |
Jul 13th 2021, 13:07 |
val |
I tried ``` $Query->getTypeMap() ->addDefaults([ 'Restaurant' => Restaurant::class, ]);``` |
# |
Jul 13th 2021, 13:02 |
val |
Hi, is there a way in Cake 3.x to tell the framework that the results of manual join in the query should be parsed as a model entity object (when there is no association to that's entity table)? |
# |
Jul 13th 2021, 12:17 |
dereuromark |
could be interesting to know also the impact of this - for a future default case one day as well |
# |
Jul 13th 2021, 12:17 |
dereuromark |
did you do a performance check here for lets say 1000 rows etc? |
# |
Jul 13th 2021, 12:17 |
dereuromark |
ok, sounds useful :) |
# |
Jul 13th 2021, 12:13 |
erwane |
@dereuromark cleaner json in an utf8 context (database tables encoding set to utf8 or utf8mb4). No need to escape everything i think. |
# |
Jul 13th 2021, 12:00 |
caseyw |
Thanks for that, I'll look into it! |
# |
Jul 13th 2021, 11:53 |
dereuromark |
I use it for font icons for example, to not have to search the correct names, but just to get the list of available ones. |
# |
Jul 13th 2021, 11:52 |
dereuromark |
e.g. any $this->Theme->get(..) etc would be able to give you a list of available magic strings, constants or alike to select from, at least in PHPStorm that works nicely. |
# |
Jul 13th 2021, 11:51 |
dereuromark |
I would also look into that for generating IDE specific meta data that can help to create auto complete lists. Most useful for magic strings. But also for a list of classes or constants on those. |