- <?php
- * @file
- * Install for a basic entity - need to create the base table for our entity.
- * This table can have as many columns as you need to keep track of
- * entity-specific data that will not be added via attached fields.
- * The minimum information for the entity to work is an id and an entity name.
- */
-
- * Implements hook_schema().
- *
- * @ingroup entity_example
- */
- function entity_example_schema() {
- $schema = array();
-
-
-
- $schema['entity_example_basic'] = array(
- 'description' => 'The base table for our basic entity.',
- 'fields' => array(
- 'basic_id' => array(
- 'description' => 'Primary key of the basic entity.',
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
-
-
-
- 'bundle_type' => array(
- 'description' => 'The bundle type',
- 'type' => 'text',
- 'size' => 'medium',
- 'not null' => TRUE,
- ),
-
-
- 'item_description' => array(
- 'description' => 'A description of the item',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'created' => array(
- 'description' => 'The Unix timestamp of the entity creation time.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'primary key' => array('basic_id'),
- );
-
- return $schema;
- }
-
-
- * Implements hook_uninstall().
- *
- * At uninstall time we'll notify field.module that the entity was deleted
- * so that attached fields can be cleaned up.
- *
- * @ingroup entity_example
- */
- function entity_example_uninstall() {
- field_attach_delete_bundle('entity_example_basic', 'first_example_bundle');
- }