# |
May 26th 2017, 15:56 |
josh_rodarte |
Yeah. It is silly though as structure changes are often followed with data changes haha. |
# |
May 26th 2017, 15:56 |
iqu |
hmic: Thanks! i got it |
# |
May 26th 2017, 15:52 |
jeremyharris |
I guess the thought was “seeding only happens on initial build” |
# |
May 26th 2017, 15:52 |
jeremyharris |
seeds often require to be run in a point in time where the database is properly set up, so I don’t see any reason why they aren’t mixed in with the migrations |
# |
May 26th 2017, 15:52 |
josh_rodarte |
I agree it would be better. |
# |
May 26th 2017, 15:51 |
jeremyharris |
but that’s a nice way of organizing them, which is better than nothing |
# |
May 26th 2017, 15:50 |
jeremyharris |
@josh_rodarte I’m was hoping for something more like `bin/cake migrations seed` that could be in a deploy hook and just run un-run seeds. would probably require tracking them like migrations are though |
# |
May 26th 2017, 15:47 |
josh_rodarte |
@jeremyharris ```./cake migrations seed --seed=BaseSeed --source=Seeds\0.0.1``` BaseSeed would then directly call seeds in it's folder. I've used this to sort of separate seeds into sets. I will come up with something that separates migrations with the sets eventually... as it is they are kind of disconnected and it can be a problem if I'm doing a full rebuild. |
# |
May 26th 2017, 15:46 |
iqu |
like ->contain(['Tags','Mediafiles','Users.id']) |
# |
May 26th 2017, 15:46 |
iqu |
in controller? |
# |
May 26th 2017, 15:45 |
iqu |
my brain is littlebit slow now.. |
# |
May 26th 2017, 15:44 |
hmic |
is it Users.id or Orders.id |
# |
May 26th 2017, 15:43 |
hmic |
qualify the id |
# |
May 26th 2017, 15:43 |
iqu |
hmic: sry, dont understand? |
# |
May 26th 2017, 15:43 |
hmic |
iqu, specify the table! |
# |
May 26th 2017, 15:41 |
iqu |
any easy fix: Error: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in order clause is ambiguous |
# |
May 26th 2017, 15:33 |
hmic |
so: conditions => ['Bids.user_id = OtherBids.user_id', ... ] instead of conditions => [ 'Bids.user_id' => 'OtherBids.user_id', ... ] will do. |
# |
May 26th 2017, 15:32 |
styks1987 |
ok super thanks |
# |
May 26th 2017, 15:31 |
hmic |
but, like i said, you can provide them in one string instead of key => value pairs and it will work |
# |
May 26th 2017, 15:31 |
hmic |
there is no option available to do so if you are using the "conditions" array notation IMHO, only when using ->where() |
# |
May 26th 2017, 15:31 |
hmic |
you do need to tell the orm that the values in your array are not values but identifiers |
# |
May 26th 2017, 15:30 |
hmic |
you do not need to change them |
# |
May 26th 2017, 15:30 |
hmic |
it gets them from the schema automatically |
# |
May 26th 2017, 15:29 |
styks1987 |
ok, do you know where the default types are defined? I don’t know what type to use? I see examples for integer |
# |
May 26th 2017, 15:26 |
hmic |
remember: use leftJoinWith ;-) |
# |
May 26th 2017, 15:26 |
hmic |
it's not available if you use the 'conditions' key in a join definition |
# |
May 26th 2017, 15:26 |
hmic |
its the second parameter to ->where() |
# |
May 26th 2017, 15:24 |
styks1987 |
I don’t see that type int he docs |
# |
May 26th 2017, 15:24 |
styks1987 |
hmic: how would I specify no value? I’d like to keep the array |
# |
May 26th 2017, 15:23 |
styks1987 |
oh, but it made it a string… yea ok you are right |
# |
May 26th 2017, 15:23 |
hmic |
easiest way: just don't do an associative array, but put them like: 'Bids.listing_id = OtherBids.listing_id', ... |
# |
May 26th 2017, 15:23 |
styks1987 |
hmic: or is it because I had them in the wrong order? It appears that I am supposed to put the joining table first in conditions? |
# |
May 26th 2017, 15:22 |
hmic |
you need to tell the orm that this is no data but identifiers |
# |
May 26th 2017, 15:22 |
hmic |
so they get casted to the fitting datatype, thats int. so your strings will all be 0 in the query |
# |
May 26th 2017, 15:22 |
hmic |
because you did not tell the orm that these are no values |
# |
May 26th 2017, 15:21 |
hmic |
yeah |
# |
May 26th 2017, 15:20 |
styks1987 |
http://paste.debian.net/943301/ |
# |
May 26th 2017, 15:20 |
styks1987 |
looks like something is up with the join. It is filling the conditions with 0 |
# |
May 26th 2017, 15:14 |
styks1987 |
hmic: I’m copying it from the ->sql() output, might try bin log next |
# |
May 26th 2017, 15:11 |
hmic |
that does not make much sense if the generated sql is what you have shwon :-/ |
# |
May 26th 2017, 15:11 |
styks1987 |
in the orm |