#165766 by hswong3i: node SQL fixes - primary keys have indexes themselfs, unique columns should not allow NULL
parent
87bdc95bff
commit
36cf322479
|
@ -719,7 +719,7 @@ function node_save(&$node) {
|
||||||
//Generate the node table query and the
|
//Generate the node table query and the
|
||||||
//the node_revisions table query
|
//the node_revisions table query
|
||||||
if ($node->is_new) {
|
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);
|
db_query($node_query, $node_table_values);
|
||||||
$node->nid = db_last_insert_id('node', 'nid');
|
$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) .')';
|
$revisions_query = 'INSERT INTO {node_revisions} ('. implode(', ', array_keys($revisions_table_types)) .') VALUES ('. implode(', ', $revisions_table_types) .')';
|
||||||
|
|
|
@ -5,7 +5,7 @@ function node_schema() {
|
||||||
$schema['node'] = array(
|
$schema['node'] = array(
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
|
'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' => ''),
|
'type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
|
||||||
'language' => array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => ''),
|
'language' => array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => ''),
|
||||||
'title' => array('type' => 'varchar', 'length' => 255, '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),
|
'translate' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
||||||
),
|
),
|
||||||
'indexes' => array(
|
'indexes' => array(
|
||||||
'nid' => array('nid'),
|
|
||||||
'node_changed' => array('changed'),
|
'node_changed' => array('changed'),
|
||||||
'node_created' => array('created'),
|
'node_created' => array('created'),
|
||||||
'node_moderate' => array('moderate'),
|
'node_moderate' => array('moderate'),
|
||||||
|
|
Loading…
Reference in New Issue