We're updating paragraphs from 8.x-1.0-rc4 to 8.x-1.0. We use Jenkins and a project.make.yml. Unfortunately when Jenkins gets to drush updatedb
, we get:
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: [error]
Column not found: 1054 Unknown column 'data.parent_id' in 'field
list': SELECT revision.*, data.parent_id AS parent_id,
data.parent_type AS parent_type, data.parent_field_name AS
parent_field_name
FROM
{paragraphs_item_revision_field_data} revision
LEFT OUTER JOIN {paragraphs_item_field_data} data ON (revision.id =
data.id and revision.langcode = data.langcode)
WHERE (revision.id IN (:db_condition_placeholder_0)) AND
(revision.revision_id IN (:db_condition_placeholder_1))
ORDER BY revision.id ASC; Array
(
[:db_condition_placeholder_0] => 211
[:db_condition_placeholder_1] => 11047
)
in
Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromSharedTables()
(line 554 of
/private/var/www/sites/mskcc_deploy/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column [error]
'data.parent_id' in 'field list' in
/private/var/www/sites/mskcc_deploy/core/lib/Drupal/Core/Database/Statement.php:59
Stack trace:
#0
...
So our database doesn't have the column data.parent_id. drush updatedb
works fine when we run it after Jenkins installs 8.x-1.0-rc4, we manually drush dl 8.x-1.0 and manually drush updatedb at that point. But we can't upgrade paragraphs like that because it would be impossible to QA our paragraphs pages and we could end up with conflicts.
Has anyone else come across this issue? If so, how did you resolve it? We have the same problem updating from 8.x-1.0-rc5 to 8.x-1.0.
I'll add more information about the schema after I rebuild again and review the database after a manual upgrade.
Thanks.
Comment | File | Size | Author |
---|---|---|---|
#14 | database-updated-using-methods.png | 20.88 KB | esod |
#14 | database-updates.png | 48.84 KB | esod |
#6 | drupal-paragraphs.png | 403.91 KB | esod |
Comments
Comment #2
miro_dietikerI guess you simply forgot to update ERR module. There are lots of related issues.
Comment #3
johnchqueSeems a problem with an outdated ERR.
Please report back if updating it fixes the problem.
Comment #4
esod CreditAttribution: esod at Memorial Sloan Kettering Cancer Center commentedWe have been running ERR 8.x-1.0.
I just tried the development release of ERR, 8.x-1.x-dev.
Unfortunately, I'm getting the same error.
Comment #5
miro_dietikerJust as a cross reference:
Did you try installing the mentioned versions manually on a vanilla Drupal.. and then update both ERR and Paragraphs to the latest dev versions?
Is it possible that you either started pre-beta (no upgrade path guarantee) or updated earlier at some point to some dev so that update methods are no more executed?
In fact column parent_id was introduced by paragraphs_update_8002 that was added 2 months post 8.x-1.0-rc4 by commit ebba36d.
So if the states were correct, this method would need to be executed.
Comment #6
esod CreditAttribution: esod at Memorial Sloan Kettering Cancer Center commentedI install vanilla Drupal and drush updb works, as it has been all along. These are the steps I take.
My vanilla system looks like this:
I'm thinking of writing an update hook to for the paragraphs updates that will run before drush updb in jenkins.
Comment #7
esod CreditAttribution: esod at Memorial Sloan Kettering Cancer Center commentedInteresting. I went through the history of our project.make.yml and we started with paragraphs 8.x-1.0-rc4
It could be
2015-Nov-17
was typed in wrong. I see commit ebba36d is from April, 2016.Comment #8
miro_dietikerWe don't type these release dates. They are autogenereated by d.o on release push.
git show 8.x-1.0-rc4
However, i see between rc4 and rc5 that there were some update bugs prior to rc5 release.
If you switched to -dev after rc4 and before rc5, that could likely have caused the problem.
Comment #9
esod CreditAttribution: esod at Memorial Sloan Kettering Cancer Center commentedWe're on rc4, so we couldn't have switched to -dev before rc5. Oh well. Thanks for
git show 8.x-1.0-rc4
. That will save me some time.I'm thinking of using a drush_hook_pre_COMMAND() to add the missing fields. Like this:
I know db_field_exists() and db_query() are deprecated functions. My concern would be if I'm overlooking an index by going directly to MySQL instead of using PDO or Doctrine methods.
Comment #10
miro_dietikerI would check on a clone of that system if it helps if you manually run paragraphs_update_8002() prior to update.
This would also be of interest:
So i'm locally at 8009 with latest dev.
This is really strange, i have requested that our team is retesting to install an vanilla rc4 and check update to rc5 and then also latest dev to make sure this process works regular.
Comment #11
johnchqueI just tested with rc4 to rc5 and demo module, the paragraphs seem to be properly updated, I also tested with the latest dev and I don't see any problem when updating. I'm locally at 8009 too.
Comment #12
esod CreditAttribution: esod at Memorial Sloan Kettering Cancer Center commentedThanks for your help. I'll have a look at drupal_get_installed_schema_version().
The module always updates from rc4 to 1.0 when we run drush updb from the command line. The error occurs during our Jenkins build.
Comment #13
esod CreditAttribution: esod at Memorial Sloan Kettering Cancer Center commentedI wrote a tiny php script, whichSchema.php, in the drupal root on a dev server that was built with rc4.
Run the script...
For completeness sake ...
On a different dev server, one whose Drupal was built with the drush_hook_pre_COMMAND()
Comment #14
esod CreditAttribution: esod at Memorial Sloan Kettering Cancer Center commentedI'm on the right track with the drush_hook_pre_COMMAND(). Adding the new fields with
db_query("ALTER TABLE...
worked fine on local and dev environments. However when we moved the drush_hook_pre_COMMAND() to our load balanced staging system we started seeing Database updates - Out of date and Entity/field definitions - Mismatched entity and/or field definitions errors.I copied the storage_definition code from paragraphs.install to the drush_hook_pre_COMMAND(). The Post updating paragraphs are now running and the error is gone.
Although you might think the field creation methods could be run twice by Jenkins since the same code is in two places, the install hooks are not run twice and the fields are not created twice. Here are the table structures after the build:
Anyway, I assume others are using Jenkins to deploy Drupal 8 and need to update paragraphs. This is how we did it.
Thank you very much for the code and the great module.