How do I use hook_update_N() to create a vocabulary? I want to create a standard vocabulary (no extra fields) in Drupal 8.7.5 programatically, using hook_update_N. I've never used this function before. So I'm a complete newbie.

I've modified a simple delete script I was shown, but something tells me it can't possibly be this simple.

Here's my starting point: 

&lt;?php

use Drupal\taxonomy\Entity\Vocabulary;

/**
 * create vocabulary testname.
 */
function ent_create_update_8105(&amp;$sandbox) {
  $vid = 'testname';
  $vocabulary = Vocabulary::load($vid);
  if (!$vocabulary) {
    $vocabulary-&gt;create();
  }
}


I assume that, once the script is created correctly, I simply run drush entup.
You should be able to do it like this:

&lt;?php

use Drupal\taxonomy\Entity\Vocabulary;

/**
 * create vocabulary testname.
 */
function ent_create_update_8105(&amp;$sandbox) {
  $vid = 'testname';
  $vocabulary = Vocabulary::load($vid);
  if (!isset($vocabulary)) {
    Vocabulary::create([
      'vid' =&gt; $vid,
      'description' =&gt; '',
      'name' =&gt; 'The vocabulary’s name',
    ])-&gt;save();
  }
}