The following updates returned messages

css_injector module

Update #7001
Failed: DatabaseSchemaObjectExistsException: Cannot add field css_injector_rule.enabled: field already exists. in DatabaseSchema_mysql->addField() (line 328 of /home/******/public_html/includes/database/mysql/schema.inc).

Comments

rfay’s picture

This probably means you were using an already-updated schema (from a dev version). And there *was* a dev version out there with bad update numbers.

Assuming your schema is already correct, you should be able to fix this by the mysql command "UPDATE system SET schema_version=7001 WHERE name='css_injector';"

@oresh, you could improve this by if (!db_field_exists()).

holgersen’s picture

I got the same error message when updating to CSS injector 7.x-1.9. I have not been using any dev version prior to the update.

After the failing update I get the following warnings:
Warning: in_array() expects parameter 2 to be array, boolean given in css_injector_init() (line 55 of /customers/***/httpd.www/sites/all/modules/css_injector/css_injector.module).

Would it still be ok to run "UPDATE system SET schema_version=7001 WHERE name='css_injector';", even after seeing this warning?

Kevin Morse’s picture

I just attempted the upgrade from 7.x-1.9 and got a different fail

Update #7001
Failed: PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'rule_themes' at row 1: ALTER TABLE {css_injector_rule} CHANGE `rule_themes` `rule_themes` TEXT NOT NULL COMMENT 'Themes that CSS rule will be applied to'; Array ( ) in db_add_field() (line 2841 of /home/xxxxxx/public_html/xxxxx/includes/database/database.inc).

Any ideas?

Jeffrey C.’s picture

Same as #3. Please advise.

Jeffrey C.’s picture

Hello there,

If you're seeing:

Failed: PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'rule_themes' at row 1: ALTER TABLE {css_injector_rule} CHANGE `rule_themes` `rule_themes` TEXT NOT NULL COMMENT 'Themes that CSS rule will be applied to'; Array ( ) in db_add_field() (line 2841 of includes/database/database.inc).

Or,

Warning: in_array() expects parameter 2 to be array, boolean given in css_injector_init() (line 55 of sites/all/modules/css_injector/css_injector.module).

#2154159: Provide the correct default value for field 'rule_themes' should be able to resolve your problem.

creeksideplayers’s picture

Same as #3. Went back to 7.x-1.8, but I'm still seeing a pending update. How do I clear this?

holgersen’s picture

The warning from #2:

Warning: in_array() expects parameter 2 to be array, boolean given in css_injector_init() (line 55 of /customers/***/httpd.www/sites/all/modules/css_injector/css_injector.module).

seems to have gone away by following the instructions in #5, although I didn't change any settings.
However, I still have one pending update which, when having been applied, results in the following failure:

Update #7001
Failed: DatabaseSchemaObjectExistsException: Cannot add field css_injector_rule.enabled: field already exists. in DatabaseSchema_mysql->addField() (line 328 of /customers/***/httpd.www/includes/database/mysql/schema.inc).

creeksideplayers’s picture

I went back to 1.9. I did the change suggested by #5. I also commented out the following lines in css_injector.install (lines 84 and 85):

  db_add_field( 'css_injector_rule', 'enabled', $enabled);
  db_add_field( 'css_injector_rule', 'rule_themes', $themes);

This makes the update succeed.

Geijutsuka’s picture

Having the same issue upon update:

Cannot add field css_injector_rule. class="placeholder">enabled: field already exists.
Performed update: css_injector_update_7001

...and the warning message:

Warning: in_array() expects parameter 2 to be array, boolean given in css_injector_init() (line 55 of /var/www/web/sites/all/modules/css_injector/css_injector.module).

Kevin Morse’s picture

I appear to be in the same boat as the others...

After going through and saving the CSS Injector rules with one theme chosen I now get the following when I update:

Update #7001
Failed: DatabaseSchemaObjectExistsException: Cannot add field css_injector_rule.enabled: field already exists. in DatabaseSchema_mysql->addField() (line 328 of /home/xxxxx/public_html/xxxxx/includes/database/mysql/schema.inc).

jontyler’s picture

Same as the others, even after selecting a theme in the rule:

The following updates returned messages

css_injector module

Update #7001
Failed: DatabaseSchemaObjectExistsException: Cannot add field css_injector_rule.enabled: field already exists. in DatabaseSchema_mysql->addField() (line 328 of /home/*********/www/www/includes/database/mysql/schema.inc).

makimaki’s picture

I'm getting the following after updating:

Update #7001
Failed: DatabaseSchemaObjectExistsException: Cannot add field css_injector_rule.enabled: field already exists. in DatabaseSchema_mysql->addField() (line 328 of /home/XXXX/YYYY/includes/database/mysql/schema.inc).