You are here

function recipe_schema in Recipe 7.2

Same name and namespace in other branches
  1. 6 recipe.install \recipe_schema()
  2. 7 recipe.install \recipe_schema()

Implements hook_schema().

File

./recipe.install, line 39
Install, update and uninstall functions for the recipe module.

Code

function recipe_schema() {
  $schema['recipe'] = array(
    'fields' => array(
      'nid' => array(
        'description' => 'The primary identifier for a recipe.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'source' => array(
        'type' => 'varchar',
        'not null' => FALSE,
        'length' => 255,
      ),
      'yield' => array(
        'type' => 'int',
        'unsigned' => FALSE,
        'not null' => TRUE,
      ),
      'yield_unit' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The units for the yield field(servings, people, cans, cookies, etc).',
      ),
      'description' => array(
        'type' => 'text',
      ),
      'instructions' => array(
        'type' => 'text',
      ),
      'notes' => array(
        'type' => 'text',
      ),
      'preptime' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'cooktime' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['recipe_ingredient'] = array(
    'description' => 'The base table for recipe ingredients.',
    'fields' => array(
      'id' => array(
        'description' => 'The primary identifier for a recipe ingredient.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'link' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  return $schema;
}