Hi,
I have been using field collection attached to nodes and a view in my site for some time without problems. Today I am finding that I am unable to access the nodes I have placed the field collection as well as the view that contains this feature. Every time I try to open these pages, I get an error report stating this:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'kambhamp_meetings.field_collection_item_revision' doesn't exist: SELECT revision.revision_id AS revision_id, base.item_id AS item_id, base.field_name AS field_name, base.archived AS archived, base.revision_id = revision.revision_id AS default_revision FROM {field_collection_item} base INNER JOIN {field_collection_item_revision} revision ON revision.revision_id = base.revision_id WHERE (base.item_id IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => 5 ) in EntityAPIController->query() (line 187 of
As I do not do coding, I am at a loss as to how to proceed. I would appreciate help to sort this problem.
Thanks
kbss
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | sandbox_2013-01-15.sql_.txt | 1.62 KB | jpschroeder |
Comments
Comment #1
kbss commentedComment #2
kaizerking commentedIf you have upgraded to latest version of field collection then you will have this problem.
field collection module has implemented revision support in the latest version
i think accordingly all the contribs which require field collection as dependency should revise their modules accordingly
Comment #3
jpschroeder commentedI upgraded field_collection from beta-4 to beta-5 using the standard drupal upgrade process. The upgrade succeeded, there are no pending database upgrades. However, upon attempting to access any content that uses field_collection, I also receive the fatal PDO error about the base table field_collection_item_revision not existing. A quick look in the database confirms...no table.
Here's what this seems to boil down to: The scheme for field_collection needs to be updated to support revisions when upgrading to beta-5. If your site actually uses field_collection, you can't upgrade the schema because its a required component of drupal. So the codebase updates, without the database updates, and your site breaks. Of course, you can get the site working again by manually adding the proper components to the db:
- Add the field_collection_item_revision table (you can import an empty one via the attached .sql file)
- Add two fields to the field_collection_item table: revision_id, archived; both should be INT(11), NOT NULL, and archived has a default of 0
This gets your site to *run* again. However, throws countless errors because even though the fatal errors of missing tables are gone, the revisions for your current content dont exist! However, this is obviously NOT the right way to do things, and I would welcome anyone who knows of a patch to fix it.
Comment #4
jpschroeder commentedYou can clear up the addition errors by performing the following SQL:
UPDATE field_collection_item SET revision_id = item_id
Then in the field_collection_item_revision table, create a simple entry for each item_id in the field_collection_item table where item_id = both revision_id and item_id
Comment #5
Traverus commentedThe SQL that implements the above idea
Comment #6
Traverus commentedYou will also need to update any already created field collections with the following SQL statements
Comment #7
Traverus commentedNext hurdle appears to be that field collection isn't setting the {FIELD_NAME}_revision_id column correctly on new collection inserts.
Comment #8
kaizerking commentedI am also facing some problems with this
Comment #9
samvel commentedI taking same error. But simply need execute updates:
So for me, this task fixed
Comment #10
samvel commentedComment #12
jaypanTo fix this, I opened the database, found the {system} table, searched for the row with name = field_collection, and changed the schema version from -1 to 7000. I then ran the database update script.
Comment #13
Arkrep commentedThanks Jaypan... your fix helped me out.