$entity); $ret = array( 'machine_name' => array( 'description' => $t('The machine name of the @entity.', $arg), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'title' => array( 'description' => $t('The human name of the @entity.', $arg), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'created' => array( 'description' => $t('The Unix timestamp when the @entity was created.', $arg), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'changed' => array( 'description' => t('The Unix timestamp when the @entity was most recently saved.', $arg), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'status' => array( 'description' => $t('The exportable status of the @entity.', $arg), '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', ), 'module' => array( 'description' => $t('The name of the providing module if the @entity has been defined in code.', $arg), 'type' => 'varchar', 'length' => 255, 'not null' => FALSE, ), ); return $ret; } function Zwing_field_schema($field) { $schema = array( 'columns' => array( 'rid' => array( 'description' => 'The id of the role performing the transition.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ), 'sid' => array( 'description' => 'The id of the state at the end of the transition.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ), ), 'indexes' => array( 'target_id' => array('rid', 'sid'), ), 'foreign keys' => array( 'role' => array( 'table' => 'role', 'columns' => array('rid' => 'rid'), ), 'next_state' => array( 'table' => 'wing_state', 'columns' => array('sid' => 'sid'), ), ), ); return $schema; } /** * Implements hook_schema(). * * - wing_state * - wing_workflow */ function Zwing_schema() { $schema = array( 'wing_state' => array( 'description' => 'The base table for Wing State entities', 'fields' => array( 'sid' => array( 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ), 'workflow' => array( 'description' => 'The {wing_workflow}.machine_name of this state.', 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => '', ), ) + _wing_exportable_schema_fields('wing_state'), 'primary key' => array('sid'), 'indexes' => array( 'workflow' => array('workflow'), ), 'unique keys' => array('machine_name' => array('machine_name')), 'foreign keys' => array( 'workflow' => array( 'table' => 'wing_workflow', 'columns' => array('workflow' => 'wid'), ), ), ), 'wing_workflow' => array( 'description' => 'The base table for Wing Workflow entities', 'fields' => array( 'wid' => array( 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ), ) + _wing_exportable_schema_fields('wing_workflow'), 'primary key' => array('wid'), 'unique keys' => array('machine_name' => array('machine_name')), ), ); return $schema; } /** * Implements hook_uninstall(). * * @see entity_test_uninstall() { */ function Zwing_uninstall() { // FIXME: provide correct values. $wing_state_types = array(); foreach ($wing_state_types as $name => $type) { field_attach_delete_bundle('entity_test', $name); } }