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'); } ?>
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( // .... cut for clarity .... 'unique keys' => array( 'nid_vid' => array('nid', 'vid'), 'vid' => array('vid') ), 'primary key' => array('nid'), ); }
You lack a return statement.
Thank's so much. On Thu, Aug 6, 2009 at 3:45 PM, Earl Miles <merlin@logrus.com> wrote:
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(
// .... cut for clarity ....
'unique keys' => array( 'nid_vid' => array('nid', 'vid'), 'vid' => array('vid') ), 'primary key' => array('nid'), ); }
You lack a return statement.
-- Damián Adriel Pérez Valdés Programador de Sistemas URL Blog: http://damianadriel.blogspot.com/
On Thursday 06 August 2009, Damian Adriel Perez Valdes wrote:
Thank's so much.
On Thu, Aug 6, 2009 at 3:45 PM, Earl Miles <merlin@logrus.com> wrote:
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(
// .... cut for clarity ....
'unique keys' => array( 'nid_vid' => array('nid', 'vid'), 'vid' => array('vid') ), 'primary key' => array('nid'), ); }
You lack a return statement.
You can build the table with phpmyadmin and use the schema module to give you the $schema code, much easier than handrolling. -- ----------------- Bob Hutchinson Midwales dot com -----------------
Someone else pointed out the return statement. I think you also cannot call your table 'table' in MySQL. --Jennifer Damian Adriel Perez Valdes wrote:
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.'),
-- Jennifer Hodgdon * Poplar ProductivityWare www.poplarware.com Drupal, WordPress, and custom Web programming
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'); } ?>
participants (5)
-
Bob Hutchinson -
Bushidodeep -
Damian Adriel Perez Valdes -
Earl Miles -
Jennifer Hodgdon