[development] Install Schema

Bushidodeep field.ninja at gmail.com
Thu Aug 6 21:15:33 UTC 2009


Hi,

"Table" is a reserved world in MySQL


C





On Aug 6, 2009, at 12:29 PM, Damian Adriel Perez Valdes wrote:

> 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');
> }
> ?>



More information about the development mailing list