-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.x Rename the entity base table #18
base: 8.x-2.x
Are you sure you want to change the base?
Conversation
tests/src/Functional/Update/SkipEntityTableUpdate8001WhenExistingTest.php
Outdated
Show resolved
Hide resolved
tests/src/Functional/Update/SkipEntityTableUpdate8001WhenExistingTest.php
Outdated
Show resolved
Hide resolved
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we now that the hook post update is skipped ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_mail
tobackerymails_sent_mails
🗃️ Issues
This pull request is related to :
🔢 To Review
Steps to review the PR:
drush updatedb -y
📸 Pay attention to