I used drupal_write_record, passing a table's name that I added later using drupal_update_x hook.
But it doesn't work and I studied its code. I found drupal_get_schema function and I studied its code also. Finally i discovered in its $schema array there aren't table added not included in hook schema.

Comments

heine’s picture

Status: Active » Closed (works as designed)

Your hook_schema should always return the updated schema. In other words: If you add a table in hook_update_N, also add it to hook_schema.