db_update query in custom installation profile gets ignored I am currenty working on a custom installation profile that enables modules, performs some db queries and so forth.

It also sets my default theme and admin_theme...

Nothing too special ;-)

I have 2 db_update queries as well, located in my .install file.

The first one works perfectly

// Enable the admin theme.
db_update('system')
-&gt;fields(array('status' =&gt; 1))
-&gt;condition('type', 'theme')
-&gt;condition('name', 'rubik')
-&gt;execute();


The second one gets 'ignored'

// Locate menus is right regions
db_update('block')
-&gt;fields(array('status' =&gt; 1, 'region' =&gt; 'sidebar_first'))
-&gt;condition('delta','menu-left-menu')
-&gt;condition('theme', 'mytheme')
-&gt;execute();


I have tried the last query with devel/php and then everything works perfectly.

What am i missing?

When i put the query in a .module file it works as well...

Thanks for any advice!
db_update it is a selectable object. It builds SQL queries. https://api.drupal.org/api/drupal/includes!database!database.inc/function/db_update/7

Yes. Everything is in database. You can changes by queries. You should use api functions or common approaches.

Theme data is stored as variables, for Drupal it is enough.

variable_set('theme', 'my_theme');
variable_set('admin_theme', 'theme_name');


https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/variable_set/7
It says that if you want change it by queries you need update the variable table.

Also when you manipulate with cache-able objects(blocks here) you need clean cache.

cache_clear_all();