I added this function to cleanetica_advanced module and after this ran /update.php

function cleanetica_advanced_schema() {
  $schema['videos'] = array (
    'description' => 'Videos with HTML titles',
    'fields' => array(
      'id' => array(
        'description' => 'Primary key for our table of videos',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      'urlinfo' => array(
        'description' => 'The string referring to the video',
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE
      'title' => array(
        'description' => 'The title for a video, used in admin part only',
        'type' => 'text',
        'size' => 'medium',
        'not null' => TRUE
      'richtitle' => array(
        'description' => 'The HTML-formatted title for a video',
        'type' => 'text',
        'size' => 'medium',
        'not null' => TRUE
    'primary key' => array('id'),

  return $schema;

But the table videos was not created.

What have I missed in order for the table to be created?

The module cleanetica_advanced is enabled and I checked that it really loads by inserting a nonsense (non-PHP) there and seeing that the site crashes with an error. (After this I removed the nonsense.)

1 Answer 1


The hook_schema is only run for table creation during module install.

To run it later, you'd need to install the schema from .install file with something like

 * Implements hook_update_N
function cleanetica_advanced_update_7001(){

Add, and then run update.php

  • And should my function cleanetica_advanced_schema() be defined in the .install file or in .module file?
    – porton
    Commented Feb 13, 2013 at 11:01
  • in the .install file Commented Feb 13, 2013 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.