I tried to use this on a brand new install and found that the database table was not created when I installed, causing several sql errors to be tossed up. I also don't see anything in the code that suggests exactly what the table should look like.

Comments

Josiah@missions.ritchietribe.net’s picture

oh, I found where this gets built, and see a comment that you know it isn't working. Maybe a comment could be made on the project page to let people know until its fixed? You could also mention that the SQL command "CREATE TABLE og_files (gid INT NOT NULL, data TEXT NOT NULL);" will take care of it until then. I did that and things seem to be functioning as expected.

function og_files_install() {
//seems to be not working
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {og_files} (
gid INT NOT NULL,
data TEXT NOT NULL
);"
);
break;
}
}

nath’s picture

The way it is done in this module is wrong. The og_files_install function should be in a og_files.install file, not in the module file itself.

cwittusen’s picture

Josiah:
I tried to break out the install function to its own install file with the modification as you documented but I still get the same problem about the table not existing. what might I be doing wrong?

Here is what I put in og_files.install
<?php
function og_files_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE og_files (gid INT NOT NULL, data TEXT NOT NULL);");
break;
}
}

pivica’s picture

Please read http://drupal.org/node/212572 and especially take a look to http://drupal.org/node/212572#comment-730037 for a patched version of module.

pivica’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.