function sarnia_update_7001 in Sarnia 7
Create the new {sarnia_solr_service_schema} table. Replaces update 7000.
File
- ./
sarnia.install, line 143
Code
function sarnia_update_7001() {
if (db_table_exists('sarnia_solr_service_schema')) {
return t('The Sarnia schema table already exists.');
}
$sarnia_solr_service_schema = array(
'description' => 'Map behaviors of Solr fields',
'fields' => array(
'id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'search_api_server' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'behavior' => array(
'type' => 'varchar',
'length' => 255,
),
'match_type' => array(
'description' => '"name", "dynamicbase", or "type"',
'type' => 'varchar',
'length' => 255,
),
'match_value' => array(
'type' => 'varchar',
'length' => 255,
),
'effect' => array(
'description' => '"disable" or "replace"',
'type' => 'varchar',
'length' => 255,
),
'replacement' => array(
'type' => 'varchar',
'length' => 255,
),
'enabled' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
),
),
'primary key' => array(
'id',
),
);
db_create_table('sarnia_solr_service_schema', $sarnia_solr_service_schema);
$query = db_insert('sarnia_solr_service_schema')
->fields(array(
'search_api_server',
'behavior',
'match_type',
'match_value',
'effect',
'replacement',
));
foreach (sarnia_solr_service_schema_defaults() as $values) {
$query
->values($values);
}
$query
->execute();
return t('Created and populated the Sarnia schema table.');
}