From 36cf32247911fb16f70a2d39dc759d8669ce4ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Fri, 10 Aug 2007 11:14:22 +0000 Subject: [PATCH] #165766 by hswong3i: node SQL fixes - primary keys have indexes themselfs, unique columns should not allow NULL --- modules/node/node.module | 2 +- modules/node/node.schema | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/node/node.module b/modules/node/node.module index 4a9e2aa2c96..d7fe1681a89 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -719,7 +719,7 @@ function node_save(&$node) { //Generate the node table query and the //the node_revisions table query if ($node->is_new) { - $node_query = 'INSERT INTO {node} (vid, '. implode(', ', array_keys($node_table_types)) .') VALUES (NULL, '. implode(', ', $node_table_types) .')'; + $node_query = 'INSERT INTO {node} ('. implode(', ', array_keys($node_table_types)) .') VALUES ('. implode(', ', $node_table_types) .')'; db_query($node_query, $node_table_values); $node->nid = db_last_insert_id('node', 'nid'); $revisions_query = 'INSERT INTO {node_revisions} ('. implode(', ', array_keys($revisions_table_types)) .') VALUES ('. implode(', ', $revisions_table_types) .')'; diff --git a/modules/node/node.schema b/modules/node/node.schema index aa6d3343cf4..30e70bf9c07 100644 --- a/modules/node/node.schema +++ b/modules/node/node.schema @@ -5,7 +5,7 @@ function node_schema() { $schema['node'] = array( 'fields' => array( 'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), - 'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'default' => 0), + 'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 'type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), 'language' => array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => ''), 'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), @@ -21,7 +21,6 @@ function node_schema() { 'translate' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), ), 'indexes' => array( - 'nid' => array('nid'), 'node_changed' => array('changed'), 'node_created' => array('created'), 'node_moderate' => array('moderate'),