How to reproduce
* Update from 1.x to 2.x - everything fine
* Create a new rule
Result:
General error: 1364 Field 'rule_themes' doesn't have a default value: INSERT INTO {css_injector_rule} (name, admin_description, css, media, preprocess, inline, page_visibility, page_visibility_pages) VALUES
Analysis:
Obviously some fields are leftover that are not part of the new schema. These are:
* enabled
* rule_type
* rule_themes
* rule_conditions
The simplest solution would be to add a new update function like so
/**
* Drop legacy fields
*/
function css_injector_update_7206(&$sandbox) {
db_drop_field('css_injector_rule','enabled');
db_drop_field('css_injector_rule','rule_type');
db_drop_field('css_injector_rule','rule_themes');
db_drop_field('css_injector_rule','rule_conditions');
}
but i'm a bit puzzled by this:
/**
* remove NOT NULL requirement on rule_conditions field
*/
function css_injector_update_7205(&$sandbox) {
if (db_field_exists('css_injector_rule', 'rule_conditions')) {
db_change_field('css_injector_rule', 'rule_conditions', 'rule_conditions', array(
'description' => 'LEGACY data to evaluate when determining if the CSS should be injected',
'type' => 'text',
'not null' => FALSE,
));
}
}
do we want to keep this legacy data that we can't edit anymore??
Comment | File | Size | Author |
---|---|---|---|
#1 | css_injector-2415482-1-Error-creating-rule-after-update.patch | 9.65 KB | geek-merlin |
Comments
Comment #1
geek-merlinYes those fields must die and so can a zombie file.
Patch flying in.
Comment #2
geek-merlinWorksforme.
Comment #3
AlfTheCat CreditAttribution: AlfTheCat commentedPatch #1 applied cleanly and the error went away, am now able to save new css rules perfectly :)
Thanks so much!
Comment #4
jhereck CreditAttribution: jhereck commentedSame problem here, and the patch above does not solve it.
Help pls !
Edit : found the problem : i had to fully uninstall the old module before reinstalling the 2.dev version, and problem gone !
Comment #5
geek-merlinRTBC as of #3