farmOS/farm_asset.install

110 lines
2.9 KiB
Plaintext

<?php
/**
* @file
* Farm asset install.
*/
/**
* Implements hook_schema().
*/
function farm_asset_schema() {
$schema['farm_asset'] = array(
'description' => 'Farm assets',
'fields' => array(
'id' => array(
'description' => 'Asset ID',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => 'Asset name',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'type' => array(
'description' => 'Asset type',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'uid' => array(
'description' => 'Asset owner',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'created' => array(
'description' => 'Timestamp when the asset was created',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'changed' => array(
'description' => 'Timestamp when the asset was last modified',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('id'),
'indexes' => array(
'name' => array('name'),
'type' => array('type'),
'uid' => array('uid'),
'created' => array('created'),
'modified' => array('changed'),
),
);
$schema['farm_asset_type'] = array(
'description' => 'Stores information about all defined asset types.',
'fields' => array(
'id' => array(
'description' => 'Primary Key: Unique asset type ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'type' => array(
'description' => 'The machine-readable name of this asset type.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'label' => array(
'description' => 'The human-readable name of this asset type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
// The following fields are required to make types exportable via
// Entity API and Ctools.
'status' => array(
'type' => 'int',
'not null' => TRUE,
// Set the default to ENTITY_CUSTOM without using the constant as it is
// not safe to use it at this point.
'default' => 0x01,
'size' => 'tiny',
'description' => 'The exportable status of the entity.',
),
'module' => array(
'description' => 'The name of the providing module if the entity has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'primary key' => array('id'),
'unique keys' => array(
'type' => array('type'),
),
);
return $schema;
}