All pastes #535907 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-06-04 06:41 UTC
rendered paste body
<?php
// $Id: node.schema,v 1.1 2007/05/25 12:46:45 dries Exp $

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' => TRUE, 'default' => 0,
        'foreign key' => array('table' => 'node_revisions', 'field' => 'vid'),
      ),
      'type'     => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
      'language' => array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => '',
        'foreign key' => array('table' => 'languages', 'field' => 'language'),
      ),
      'title'    => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
      'uid'      => array('type' => 'int', 'not null' => TRUE, 'default' => 0,
        'foreign key' => array('table' => 'users', 'field' => 'uid'),
      ),
      'status'   => array('type' => 'int', 'not null' => TRUE, 'default' => 1),
      'created'  => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'changed'  => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'comment'  => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'promote'  => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'moderate' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'sticky'   => 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'),
      'node_promote_status' => array('promote', 'status'),
      'node_status_type'    => array('status', 'type', 'nid'),
      'node_title_type'     => array('title', array('type', 4)),
      'node_type'           => array(array('type', 4)),
      'status'              => array('status'),
      'uid'                 => array('uid')
    ),
    'unique keys' => array(
      'nid_vid' => array('nid', 'vid'),
      'vid'     => array('vid')
    ),
    'primary key' => array('nid'),
  );

  $schema['node_access'] = array(
    'fields' => array(
      'nid'          => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
      'gid'          => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
      'realm'        => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'grant_view'   => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'grant_update' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'grant_delete' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')
    ),
    'primary key' => array(
      'nid',
      'gid',
      'realm'
    ),
  );

  $schema['node_counter'] = array(
    'fields' => array(
      'nid'        => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'totalcount' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'big'),
      'daycount'   => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'medium'),
      'timestamp'  => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)
    ),
    'primary key' => array('nid'),
  );

  $schema['node_revisions'] = array(
    'fields' => array(
      'nid'       => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE),
      'vid'       => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
      'uid'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'title'     => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
      'body'      => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'teaser'    => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'log'       => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'format'    => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
    ),
    'indexes' => array(
      'nid' => array('nid'),
      'uid' => array('uid')
    ),
    'primary key' => array('vid'),
  );

  $schema['node_type'] = array(
    'fields' => array(
      'type'           => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE),
      'name'           => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'module'         => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
      'description'    => array('type' => 'text', 'not null' => TRUE, 'size' => 'medium'),
      'help'           => array('type' => 'text', 'not null' => TRUE, 'size' => 'medium'),
      'has_title'      => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'size' => 'tiny'),
      'title_label'    => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'has_body'       => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'size' => 'tiny'),
      'body_label'     => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'min_word_count' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'size' => 'small'),
      'custom'         => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'modified'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'locked'         => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'orig_type'      => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')
    ),
    'primary key' => array('type'),
  );

  return $schema;
}