2009-02-03 17:30:13 +00:00
|
|
|
<?php
|
|
|
|
// $Id$
|
2009-02-10 03:16:15 +00:00
|
|
|
|
2009-05-13 19:42:18 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Install, update and uninstall functions for the field module.
|
|
|
|
*/
|
|
|
|
|
2009-02-03 17:30:13 +00:00
|
|
|
/**
|
2009-05-27 18:34:03 +00:00
|
|
|
* Implement hook_schema.
|
2009-02-03 17:30:13 +00:00
|
|
|
*/
|
|
|
|
function field_schema() {
|
|
|
|
// Static (meta) tables.
|
|
|
|
$schema['field_config'] = array(
|
|
|
|
'fields' => array(
|
2009-03-10 09:45:32 +00:00
|
|
|
'id' => array(
|
|
|
|
'type' => 'serial',
|
|
|
|
'not null' => TRUE,
|
|
|
|
'description' => 'The primary identifier for a field',
|
|
|
|
),
|
2009-02-03 17:30:13 +00:00
|
|
|
'field_name' => array(
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => 32,
|
|
|
|
'not null' => TRUE,
|
2009-05-28 10:05:32 +00:00
|
|
|
'description' => 'The name of this field. Non-deleted field names are unique, but multiple deleted fields can have the same name.',
|
2009-02-03 17:30:13 +00:00
|
|
|
),
|
|
|
|
'type' => array(
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => 128,
|
|
|
|
'not null' => TRUE,
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'description' => 'The type of this field.',
|
2009-02-03 17:30:13 +00:00
|
|
|
),
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'module' => array(
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => 128,
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => '',
|
|
|
|
'description' => 'The module that implements the field type.',
|
|
|
|
),
|
|
|
|
'active' => array(
|
2009-02-03 17:30:13 +00:00
|
|
|
'type' => 'int',
|
|
|
|
'size' => 'tiny',
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'description' => 'Boolean indicating whether the module that implements the field type is enabled.',
|
2009-02-03 17:30:13 +00:00
|
|
|
),
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'storage_type' => array(
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => 128,
|
2009-02-03 17:30:13 +00:00
|
|
|
'not null' => TRUE,
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'description' => 'The storage backend for the field.',
|
2009-02-03 17:30:13 +00:00
|
|
|
),
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'storage_module' => array(
|
2009-02-03 17:30:13 +00:00
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => 128,
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => '',
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'description' => 'The module that implements the storage backend.',
|
2009-02-03 17:30:13 +00:00
|
|
|
),
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'storage_active' => array(
|
2009-02-03 17:30:13 +00:00
|
|
|
'type' => 'int',
|
|
|
|
'size' => 'tiny',
|
|
|
|
'not null' => TRUE,
|
2009-05-28 10:05:32 +00:00
|
|
|
'default' => 0,
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'description' => 'Boolean indicating whether the module that implements the storage backend is enabled.',
|
2009-02-03 17:30:13 +00:00
|
|
|
),
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'locked' => array(
|
2009-08-22 00:58:55 +00:00
|
|
|
'type' => 'int',
|
|
|
|
'size' => 'tiny',
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'description' => '@TODO',
|
2009-08-22 00:58:55 +00:00
|
|
|
),
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'data' => array(
|
|
|
|
'type' => 'text',
|
|
|
|
'size' => 'medium',
|
|
|
|
'not null' => TRUE,
|
|
|
|
'serialize' => TRUE,
|
|
|
|
'description' => 'Serialized data containing the field properties that do not warrant a dedicated column.',
|
|
|
|
),
|
|
|
|
'cardinality' => array(
|
|
|
|
'type' => 'int',
|
|
|
|
'size' => 'tiny',
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
|
|
|
),
|
|
|
|
'translatable' => array(
|
2009-02-03 17:30:13 +00:00
|
|
|
'type' => 'int',
|
|
|
|
'size' => 'tiny',
|
|
|
|
'not null' => TRUE,
|
2009-05-28 10:05:32 +00:00
|
|
|
'default' => 0,
|
2009-02-03 17:30:13 +00:00
|
|
|
),
|
|
|
|
'deleted' => array(
|
|
|
|
'type' => 'int',
|
|
|
|
'size' => 'tiny',
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
|
|
|
),
|
|
|
|
),
|
2009-03-10 09:45:32 +00:00
|
|
|
'primary key' => array('id'),
|
2009-02-03 17:30:13 +00:00
|
|
|
'indexes' => array(
|
2009-05-28 10:05:32 +00:00
|
|
|
'field_name' => array('field_name'),
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
// Used by field_read_fields().
|
|
|
|
'active' => array('active'),
|
|
|
|
'storage_active' => array('storage_active'),
|
|
|
|
'deleted' => array('deleted'),
|
|
|
|
// Used by field_modules_disabled().
|
2009-02-03 17:30:13 +00:00
|
|
|
'module' => array('module'),
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'storage_module' => array('storage_module'),
|
|
|
|
// Used by field_associate_fields().
|
2009-02-03 17:30:13 +00:00
|
|
|
'type' => array('type'),
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
'storage_type' => array('storage_type'),
|
2009-02-03 17:30:13 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
$schema['field_config_instance'] = array(
|
|
|
|
'fields' => array(
|
2009-03-10 09:45:32 +00:00
|
|
|
'id' => array(
|
|
|
|
'type' => 'serial',
|
|
|
|
'not null' => TRUE,
|
|
|
|
'description' => 'The primary identifier for a field instance',
|
|
|
|
),
|
|
|
|
'field_id' => array(
|
|
|
|
'type' => 'int',
|
|
|
|
'not null' => TRUE,
|
|
|
|
'description' => 'The identifier of the field attached by this instance',
|
|
|
|
),
|
2009-10-01 19:16:57 +00:00
|
|
|
'field_name' => array(
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => 32,
|
2009-02-03 17:30:13 +00:00
|
|
|
'not null' => TRUE,
|
2009-10-01 19:16:57 +00:00
|
|
|
'default' => ''
|
|
|
|
),
|
2009-10-15 12:44:36 +00:00
|
|
|
'object_type' => array(
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => 32,
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => ''
|
|
|
|
),
|
2009-10-01 19:16:57 +00:00
|
|
|
'bundle' => array(
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => 128,
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => ''
|
2009-02-03 17:30:13 +00:00
|
|
|
),
|
|
|
|
'data' => array(
|
|
|
|
'type' => 'text',
|
|
|
|
'size' => 'medium',
|
|
|
|
'not null' => TRUE,
|
|
|
|
'serialize' => TRUE,
|
|
|
|
),
|
|
|
|
'deleted' => array(
|
|
|
|
'type' => 'int',
|
|
|
|
'size' => 'tiny',
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
|
|
|
),
|
|
|
|
),
|
2009-03-10 09:45:32 +00:00
|
|
|
'primary key' => array('id'),
|
2009-02-03 17:30:13 +00:00
|
|
|
'indexes' => array(
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
// Used by field_delete_instance().
|
2009-10-15 12:44:36 +00:00
|
|
|
'field_name_bundle' => array('field_name', 'object_type', 'bundle'),
|
- Patch #443422 by yched, bjaspan | chx, merlinofchaos, Scott Reynolds, plach, profix898, mattyoung: added support for pluggable 'per field' storage engine. Comes with documentation and tests.
The Field Attach API uses the Field Storage API to perform all "database access". Each Field Storage API hook function defines a primitive database operation such as read, write, or delete. The default field storage module, field_sql_storage.module, uses the local SQL database to implement these operations, but alternative field storage backends can choose to represent the data in SQL differently or use a completely different storage mechanism such as a cloud-based database.
2009-09-27 12:52:55 +00:00
|
|
|
// Used by field_read_instances().
|
|
|
|
'deleted' => array('deleted'),
|
2009-02-03 17:30:13 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
$schema['cache_field'] = drupal_get_schema_unprocessed('system', 'cache');
|
|
|
|
|
|
|
|
return $schema;
|
|
|
|
}
|