I have just tried to install salesforce module on my fresh D7 instance. and got this error,
DOException: SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'drupal_type' doesn't exist in table: CREATE TABLE {salesforce_object_map} ( `fieldmap` INT unsigned NOT NULL DEFAULT 0 COMMENT 'Fieldmap id', `oid` INT unsigned NOT NULL DEFAULT 0 COMMENT 'Specific Drupal object identifier (e.g. node id or comment id)', `sfid` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'Salesforce object identifier (e.g. \"node\", \"comment\")', `drupal_entity` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'Drupal entity (e.g. \"node\", \"user\")', `drupal_bundle` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'Drupal bundle (e.g. \"page\", or vocabulary name)', PRIMARY KEY (`drupal_type`, `oid`), INDEX `sfid` (`sfid`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Drupal to Salesforce object mapping table'; Array ( ) in db_create_table() (line 2588 of /var/www/yogesh/drupal-7/includes/database/database.inc).
When I check for details in above error, it is saying 'Key column 'drupal_type' doesn't exist in table', so I check for hook_schema in D7 and this is like we are giving primary key 'primary key' => array('nid'),
And in salesforce api install file it is given like this
line no. 80 'primary key' => array('drupal_type', 'oid'),
When I change this to
line no. 80 'primary key' => array('oid'),
the error msg get solved.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 1033614-primary_key.patch | 800 bytes | aaronbauman |
| #8 | salesforce_api.install.patch | 601 bytes | cooperq |
Comments
Comment #1
EvanDonovan commentedSounds like the drupal_type field has been removed in the schema for 7.x.
Unfortunately, the 6.x version has been getting a lot more attention recently, so you may run into other issues. Does your project require 7.x?
Thanks for testing!
Comment #2
yogeshchaugule8 commentedActually We are trying to import some sites from D6 to D7.
And one of our site includes the salesforce, because of which I was trying this module to install in D7
Comment #3
EvanDonovan commented@yogeshchaugule8: As far as I know, there is not an upgrade path between the 6.x and 7.x versions yet. (Plus, the 6.x version you are using may be a dev, in which case the date on it matters to what the schema is.)
Someone else might be able to provide more info though.
Can you provide a patch for the fix that you made to 7.x?
Comment #4
yogeshchaugule8 commentedI dont know how to add a patch to module, but before adding patch we need to solve the other issues as well.
I have already added the line which solved that problem in above. adding again
before
'primary key' => array('drupal_type', 'oid'),
after
'primary key' => array('oid'),
while installing sub-module in salesforce I am getting this error.
DatabaseSchemaObjectExistsException: Table salesforce_prematch already exists. in DatabaseSchema->createTable() (line 630 of /var/www/drupal-7/includes/database/schema.inc).
I have not get any chance to see this in details.
Comment #5
yogeshchaugule8 commentedDatabaseSchemaObjectExistsException: Table salesforce_prematch already exists. in DatabaseSchema->createTable() (line 630 of /var/www/drupal-7/includes/database/schema.inc).
This problem is related to this one
http://drupal.org/node/821684#comment-3210394
nicholasThompson is saying in his comment
"It seems hook_schema() now gets called in install and uninstall automatically"
If I am commenting hook_install then this problem is not comming.
Comment #6
EvanDonovan commented@yogeshchaugule8: The actual fix for this would be to check if the table exists first, and only call drupal_install_schema if it does not.
But you have combined two different problems into one issue. The "table already exists" should be a separate issue.
Comment #7
yogeshchaugule8 commentedThank you EvanDonovan,
I have created a new issues 'Table salesforce_prematch already exists'
Comment #8
cooperq commentedI was also having this problem when installing Salesforce on a NEW copy of drupal 7 (no upgrade). I created a patch based on @yogeshchaugule8 suggestion of how to fix it. I reccomend this patch get rolled in immediately as at least for me, this bug was a blocker, making my whole site go down.
Comment #9
aaronbaumana few things:
'oid'alone is not sufficiently specific to serve as a primary key - a user, node, and order can all have the same numeric id.'drupal_entity', 'drupal_bundle', 'oid''fieldmap', 'oid', 'sfid'or simply'oid', 'sfid'Please feel free to use the attached stop-gap patch (updating the key to
'drupal_entity', 'drupal_bundle', 'oid'), but i'm going to postpone this on #1018690Comment #10
aaronbaumanSeeing as how at least one other person ran into this issue (#1075724: Cannot enable module), it makes sense to roll patch from #9 is into 7.x-dev
This is done pending rollback based on #1018690.
http://drupalcode.org/project/salesforce.git/commit/ddb0407
Leaving as postponed on that issue.
Comment #11
EvanDonovan commentedThis issue will probably need to be re-titled, but I'm moving it up to 7.x-2.x now, to remind myself that I will need to consider this when designing the schema for that branch.
Comment #12
EvanDonovan commentedFixed in 7.x-2.x now - see salesforce_api.install for details. If you think the schema needs further discussion, please reopen.