I've tried installing and uninstalling on my dev site and live site about 10 times, going so far as to disable 75% of the other modules, and it just won't create the opengraph_meta table in the database. The module seems to work, using the default settings, but it throws PHP errors on every page load because the table doesn't exist.

Anyone have any ideas? Not familiar enough with MySQL to manually create the table myself. . . .

CommentFileSizeAuthor
#2 1151668-schema.patch1.02 KBJorrit
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DanieGrabe’s picture

Found this here in another issue:

CREATE TABLE IF NOT EXISTS `opengraph_meta` (
`nid` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`description` longtext NOT NULL,
`image` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`optional` text,
PRIMARY KEY (`nid`)
)

I know its late - maybe this helps....

Jorrit’s picture

Version: 6.x-1.5 » 6.x-1.x-dev
Category: support » bug
Priority: Normal » Major
Status: Active » Needs review
FileSize
1.02 KB

The problem is that the code that generates the database table contains an error: text columns should not have a default value. The Drupal 7 version is not affected. I have attached a patch to fix this problem.

I am changing this bug to major because the bug prevents people from installing this module.

hiddentao’s picture

Fixed in 6.x-1.x dev.

hiddentao’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

Patched in 6.x-1.x-dev.

doublejosh’s picture

Rather strangely this caused a problem for us on production, but not when we installed and tested on dev and staging.

Are there perhaps some DB configurations that would allow the install/create script to work?

Jorrit’s picture

Maybe MySQL has some strictness levels that allow the faulty SQL. By the way hiddentao: this bug does not exist in 7.x.

doublejosh’s picture

May be worth mentioning that the "faulty mySQL" is longtext with a default value.

doublejosh’s picture

Interestingly enough the install script uses a schema DB abstraction object that seems like the right way to do it.
Looks like it's just the description column's 'default' => '', entry, which probably came from a module builder :)

Perhaps someone more familiar with that structure could shed some light on how to do this properly?

function opengraph_meta_schema(){
    $schema[OPENGRAPH_META_TABLE] = array(
      'description' => 'Stores Open Graph meta tag info useful for when sharing nodes on social networking sites, e.g. Facebook.',
      'fields' => array(
        'nid' => array(
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
        ),
        OpenGraphMeta::TITLE => array(
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
          'default' => ''
        ),
        OpenGraphMeta::DESCRIPTION => array(
          'type' => 'text',
          'not null' => TRUE,
          'size' => 'big',
          'default' => '', // <<< HERE IS THE SILLY PROBLEM.
        ),
        OpenGraphMeta::IMAGE => array(
          'type' => 'varchar',
          'length' => '255',
          'not null' => TRUE,
          'default' => '',
        ),
        OpenGraphMeta::TYPE => array(
          'type' => 'varchar',
          'length' => '255',
          'not null' => TRUE,
          'default' => '',
        ),
        OpenGraphMeta::__OPTIONAL_DB_FIELD => array(
          'type' => 'text',
          'not null' => FALSE,
          'default' => '',
          'serialize' => TRUE,
        ),
      ),
      'primary key' => array('nid'),
    );

    return $schema;
}

hiddentao’s picture

Status: Patch (to be ported) » Closed (fixed)

I've gotten rid of the 'default' => '' line in both 6.x and 7.x now. Fixed in dev.

hiddentao’s picture

Status: Closed (fixed) » Fixed
doublejosh’s picture

Cool. thanks so much.
Might as well document this is related to the sql-mode...
http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_stri...

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