Conversation
| if ($database->schema()->tableExists('backerymails_sended_mail') && $database->schema()->tableExists('backerymails_sent_mails')) { | ||
| $query = $database->select('backerymails_sended_mail', 'sent_mails') | ||
| ->fields('sent_mails'); | ||
| $tuples = $query->execute()->fetchAll(); |
There was a problem hiding this comment.
Hard to tell if we need to Batch API here (and the use of $sandbox argument). Did you test it with production data?
There was a problem hiding this comment.
I try but on small project, your're right I will try on a huge database
|
|
||
| $this->assertEquals(1, $database->query('SELECT count(*) FROM {backerymails_sent_mails}')->fetchField()); | ||
| $backerymails = BackerymailsEntity::loadMultiple(); | ||
| $this->assertCount(1, $backerymails); |
There was a problem hiding this comment.
How do we now that the hook post update is skipped ?
There was a problem hiding this comment.
I removed the tests, the post update is not skipped it will always, run if the old table still exists (but we remove that table at the end of psot_udate).
…:antistatique/drupal-backerymails into feature/16-refactoring-entity-base-table
Co-authored-by: Gilles Doge <gilles@antistatique.net>
| function backerymails_post_update_8001_migrate_data(&$sandbox = NULL) { | ||
| $database = Database::getConnection(); | ||
|
|
||
| if ($database->schema()->tableExists('backerymails_sended_mail') && $database->schema()->tableExists('backerymails_sent_mails')) { |
There was a problem hiding this comment.
use early return that explain:
as post_update will always run independent of hook_update, but only once. Ensure we don't run migrate if the module was already installed postschema 8001 (we may tests that instead of tableexists)
💬 Describe the pull request
Rename base table from
backerymails_sended_mailtobackerymails_sent_mails🗃️ Issues
This pull request is related to :
🔢 To Review
Steps to review the PR:
drush updatedb -y📸 Pay attention to