computed field declares that it will save not null as 0, then uses FALSE. Probs an easy fix, no?

column field_my_field - difference on: not null
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => 0, 'precision' => '32', 'scale' => '2')
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '32', 'scale' => '2')

best

Comments

Anonymous’s picture

Am also seeing this:

column field_biblio_au_ln_value - difference on: not null
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '128', 'not null' => 0)
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '128', 'not null' => FALSE)
claudiuv’s picture

This bug is also in the 7.x-1.0 version

WorldFallz’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Issue summary: View changes

marked #2405839: field_sql_storage mismatch in schema module as dupe. Updating version as any fix would be rolled for d7 first, then backported.

WorldFallz’s picture

Changing:

// Add 'not null' settings
$columns['value']['not null'] = isset($settings['database']['data_not_NULL']) ? $settings['database']['data_not_NULL'] : TRUE;

to

// Add 'not null' settings
if (isset($settings['database']['data_not_NULL'])) {
    if ($settings['database']['data_not_NULL'] === 0) $settings['database']['data_not_NULL'] = FALSE;
    if ($settings['database']['data_not_NULL'] === 1) $settings['database']['data_not_NULL'] = TRUE;
}
$columns['value']['not null'] = isset($settings['database']['data_not_NULL']) ? $settings['database']['data_not_NULL'] : TRUE;

In the .install file fixes the mismatch, but I'm not sure that's the 'correct' (clean) way to fix it.

It stems from the fact that the 'Not Null' setting for computed fields is 1 or 0 (checkbox) but schema api is looking for TRUE/FALSE.

The better way to fix this would probably be to ensure the value of the checkbox is translated from 1/0 to TRUE/FALSE when saved.

ram4nd’s picture

Priority: Minor » Normal
Status: Active » Needs work