diff --git a/fulcrm_webhook.install b/fulcrm_webhook.install index 69f3d9b..8f7bab8 100644 --- a/fulcrm_webhook.install +++ b/fulcrm_webhook.install @@ -2,5 +2,41 @@ function fulcrm_webhook_install() { $url = fulcrm_uuid_uuid4(); - variable_set( 'fulcrm_webhook_url', $url ); + variable_set( 'fulcrm_webhook_url', variable_get( 'fulcrm_webhook_url', $url ) ); +} + +function fulcrm_webhook_schema() { + $schema[ 'fulcrm_webhook_entity_mapping' ] = array( 'description' => '', + 'fields' => array( 'entity_type' => array( 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + ), + 'bundle' => array( 'description' => 'The {node_type}.type of this node.', + 'type' => 'varchar', + 'length' => 128, + 'default' => NULL, + ), + 'entity_id' => array( 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'description' => 'The entity id this data is attached to', + ), + 'fulcrm_type' => array( 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + 'description' => 'The fulcrm model/type', + ), + 'fulcrm_pk' => array( 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'description' => 'The fulcrm model primary key', + ), + ), + 'primary key' => array( 'entity_type', 'bundle', 'entity_id' ), + 'unique keys' => array( 'fulcrm_key' => array( 'fulcrm_type', 'fulcrm_pk' ), + ), + 'indexes' => array( 'fulcrm_index' => array( 'fulcrm_type', 'fulcrm_pk' ), + ), + ); + return $schema; }