Question

I need to create custom table for module, but after module install table is not created.

module.install file:

function bip_content_migration_schema() {

    $schema['bip_migrate'] = array(

            'description' => 'Storing content migration info from Joomla.',
            'fields' => array(

                    'id' => array(
                            'description' => 'id',
                            'type' => 'serial',
                    ),
                    'content_type' => array(
                            'description' => 'content type',
                            'type' => 'varchar',
                            'not null' => TRUE,
                            'length' => 255,
                    ),
                    'imported_count' => array(
                            'description' => 'imported count',
                            'type' => 'int',
                            'not null' => TRUE,
                            'default' => 0,
                    ),
                    'to_import_count' => array(
                            'description' => 'to import count',
                            'type' => 'int',
                            'not_null' => TRUE,
                    ),
                    'is_imported' => array(
                            'description' => 'is imported',
                            'type' => 'int',
                            'default' => 0,
                    ),
            ),
            'primary key' => array('id'),
            'indexes' => array(
                    'id' => array('id'),
            ),
    );
    return $schema;

}

What am I doing wrong?

EDIT

I added functions to my .install file (thought that I can ommit theme)

function bip_content_migration_install() {
    drupal_install_schema('bip_content_migration');
}

function bip_content_migration_uninstall() {
    drupal_uninstall_schema('bip_content_migration');
}

But again table is not created.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top