function recipe_schema in Recipe 7
Same name and namespace in other branches
- 6 recipe.install \recipe_schema()
- 7.2 recipe.install \recipe_schema()
Implements hook_schema().
File
- ./
recipe.install, line 27 - 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_node_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,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'unit_key' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Untranslated unit key from the units array.',
),
'quantity' => array(
'type' => 'float',
'not null' => FALSE,
),
'ingredient_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Ingredient weight within recipe.',
),
'note' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Ingredient processing or notes related to recipe.',
),
),
'primary key' => array(
'id',
),
);
$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;
}