fix: add migration to update default order by "creation_date" to "date"

This commit is contained in:
vnmedeiros 2023-03-13 09:49:20 -03:00
parent 5c1864da32
commit 20d6d4a5cc
1 changed files with 12 additions and 0 deletions

View File

@ -497,6 +497,18 @@ class Migrations {
);
}
static function update_default_collections_orderby() {
global $wpdb;
// update default order by "creation_date" to "date"
$wpdb->query(
"UPDATE $wpdb->postmeta SET meta_value = 'date'
WHERE meta_key='default_orderby'
AND meta_value='creation_date'
AND post_id IN (SELECT ID from $wpdb->posts WHERE post_type='tainacan-collection')
"
);
}
}