Right after upgrading to 4.7.3, I installed fileshare node and an error was generated (see attached screen dump). Directories were created and the module registered itself in the database's system table, but the node_fileshare table was not created. The problem seemed to be in the install, so I deleted the module from the system table and modified the fileshare.install file, adding single quotes around the two occurences of the word 'FALSE'. For good measure, I also tossed a semicolon on the end of the SQL command. When I reinstalled, it worked.
before:
db_query("CREATE TABLE {node_fileshare}
(
vid INT(4) UNSIGNED DEFAULT '0' NOT NULL ,
nid INT(4) UNSIGNED DEFAULT '0' NOT NULL ,
_filepath VARCHAR(255) NOT NULL ,
_thumbs BOOL DEFAULT FALSE NOT NULL ,
_modify BOOL DEFAULT FALSE NOT NULL ,
PRIMARY KEY (vid,nid)
) /*!40100 DEFAULT CHARACTER SET utf8 */"
);
edited:
db_query("CREATE TABLE {node_fileshare}
(
vid INT(4) UNSIGNED DEFAULT '0' NOT NULL ,
nid INT(4) UNSIGNED DEFAULT '0' NOT NULL ,
_filepath VARCHAR(255) NOT NULL ,
_thumbs BOOL DEFAULT 'FALSE' NOT NULL ,
_modify BOOL DEFAULT 'FALSE' NOT NULL ,
PRIMARY KEY (vid,nid)
) /*!40100 DEFAULT CHARACTER SET utf8 */;"
);
Perhaps the single quotes don't matter for everyone, but they did on my installation. I can see from the edit history that they were present until a recent revision.
| Comment | File | Size | Author |
|---|---|---|---|
| snapshot2_1.png | 130.49 KB | dhakajack |
Comments
Comment #1
JamieR commentedInteresting. I'm a postgreSQL guy, so I've been relying on the code that phpMyAdmin auto generated. However, in looking into the documentation for MySQL, I found this about the BOOL (boolean) datatype:
http://mysql.org/doc/refman/5.0/en/other-vendor-data-types.html
Seems perhaps that I should be using TINYINT ? Can any of you MySQL guys confirm or deny this?
Thanks for the feedback!
Jamie.
Comment #2
bomarmonk commentedHacajack's fix worked for me. I had the same problem installing the MySQL table until I used his edited install code. Now the module installs as expected.
Comment #3
JamieR commentedThat's how I originally had the code - but others were having problems with it. No feedback about the tinyint datatype?
Comment #4
thewebtailor commentedMySQL automatically maps the 'BOOL' data type at table creation time, so although the script thinks it has created a BOOL type column, it hasn't.
You shouldn't need to worry about it - MySQL will do the necessary.
Comment #5
JamieR commentedOkay - looking at other modules' MySQL I've come up with this:
If I don't' hear that this is wrong, I'm going to change the normal distribution to reflect this new code. Thanks fo the help!
Jamie.
Comment #6
JamieR commentedhttp://drupal.org/cvs?commit=38781
Comment #7
(not verified) commented