[development] Install Schema

Damian Adriel Perez Valdes damian.adriel at gmail.com
Thu Aug 6 19:29:18 UTC 2009


Hi:

How can i install a table in mysql.

I tried with this script but don't work.

function tags_schema() {
$schema['table'] = array(
    'description' => t('The base table for nodes.'),
    'fields' => array(
      'nid' => array(
        'description' => t('The primary identifier for a node.'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE),
      'vid' => array(
        'description' => t('The current {node_revisions}.vid version
identifier.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0),
      'type' => array(
        'description' => t('The {node_type} of this node.'),
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => ''),
      'title' => array(
        'description' => t('The title of this node, always treated a
non-markup plain text.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => ''),
      ),
    'indexes' => array(
      'node_changed'        => array('changed'),
      'node_created'        => array('created'),
      ),
    'unique keys' => array(
      'nid_vid' => array('nid', 'vid'),
      'vid'     => array('vid')
      ),
    'primary key' => array('nid'),
    );
}

function tags_install() {
// Crea mi tabla
drupal_install_schema('tags');
}

function tags_uninstall() {
// Borra mi tabla
drupal_uninstall_schema('tags');
}
?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/development/attachments/20090806/c08257e1/attachment-0001.htm>


More information about the development mailing list