https://softwareengineering.stackexchange.com/questions/215429/is-it-wise-to-store-a-big-lump-of-json-on-a-database-row
Debug datetime sort error
// get last updated review inside a shop (max two latest reviews)
if(isset($a['my_reviews'][1])) {
if( strtotime(@$a['my_reviews'][1]['updated_at']) > strtotime($a_last_updated) ) {
if (strpos(@$a['my_reviews'][0]['updated_at'], '2019-01-17') !== false) {
Log::debug(@$a['my_reviews'][0]['updated_at']. " " .@$a['my_reviews'][1]['updated_at']);
}
@$a['my_reviews'][0]['updated_at'] = @$a['my_reviews'][1]['updated_at'];
if (strpos(@$a['my_reviews'][0]['updated_at'], '2019-01-17') !== false) {
Log::debug(@$a['my_reviews'][0]['updated_at']. " after ");
}
}
}
if(isset($b['my_reviews'][1])) {
if( strtotime(@$b['my_reviews'][1]['updated_at']) > strtotime($b_last_updated) ) {
if (strpos(@$b['my_reviews'][0]['updated_at'], '2019-01-17') !== false) {
Log::debug(@$b['my_reviews'][0]['updated_at']. " " .@$b['my_reviews'][1]['updated_at']);
}
@$b['my_reviews'][0]['updated_at'] = @$b['my_reviews'][1]['updated_at'];
//Log::debug(@$b['my_reviews'][0]['updated_at']. " " .@$b['my_reviews'][1]['updated_at']);
if (strpos(@$b['my_reviews'][0]['updated_at'], '2019-01-17') !== false) {
Log::debug(@$b['my_reviews'][0]['updated_at']. " after ");
}
}
}
This one is working correctly but a very interesting bug here:
I only update the latest updated_at but NOT THE POST_ID
So when get latest POST_ID by updated_at it return wrong ID (it HAVE TO update within the updated_at)
==> my_reviews][0][review_id] = my_reviews[1]... ?
It seem swapping two review inside a shop not work. So I end up using simple loop to get latest one.
Careful with sort return data. We should double check data return on critical data like id, updated_at...
Migration reset ka boom :)
Don't worry, use path for specific schema table:
sudo php artisan migrate:reset --path=database/migrations/2020_03_04_193041_create_abc_table.php
Debug datetime sort error
// get last updated review inside a shop (max two latest reviews)
if(isset($a['my_reviews'][1])) {
if( strtotime(@$a['my_reviews'][1]['updated_at']) > strtotime($a_last_updated) ) {
if (strpos(@$a['my_reviews'][0]['updated_at'], '2019-01-17') !== false) {
Log::debug(@$a['my_reviews'][0]['updated_at']. " " .@$a['my_reviews'][1]['updated_at']);
}
@$a['my_reviews'][0]['updated_at'] = @$a['my_reviews'][1]['updated_at'];
if (strpos(@$a['my_reviews'][0]['updated_at'], '2019-01-17') !== false) {
Log::debug(@$a['my_reviews'][0]['updated_at']. " after ");
}
}
}
if(isset($b['my_reviews'][1])) {
if( strtotime(@$b['my_reviews'][1]['updated_at']) > strtotime($b_last_updated) ) {
if (strpos(@$b['my_reviews'][0]['updated_at'], '2019-01-17') !== false) {
Log::debug(@$b['my_reviews'][0]['updated_at']. " " .@$b['my_reviews'][1]['updated_at']);
}
@$b['my_reviews'][0]['updated_at'] = @$b['my_reviews'][1]['updated_at'];
//Log::debug(@$b['my_reviews'][0]['updated_at']. " " .@$b['my_reviews'][1]['updated_at']);
if (strpos(@$b['my_reviews'][0]['updated_at'], '2019-01-17') !== false) {
Log::debug(@$b['my_reviews'][0]['updated_at']. " after ");
}
}
}
This one is working correctly but a very interesting bug here:
I only update the latest updated_at but NOT THE POST_ID
So when get latest POST_ID by updated_at it return wrong ID (it HAVE TO update within the updated_at)
==> my_reviews][0][review_id] = my_reviews[1]... ?
It seem swapping two review inside a shop not work. So I end up using simple loop to get latest one.
Careful with sort return data. We should double check data return on critical data like id, updated_at...
Migration reset ka boom :)
Don't worry, use path for specific schema table:
sudo php artisan migrate:reset --path=database/migrations/2020_03_04_193041_create_abc_table.php
Comments
Post a Comment