From 93778a18fb2f738cef54192ad609af02509581a1 Mon Sep 17 00:00:00 2001 From: Mauricio Dinarte Date: Wed, 4 Dec 2024 10:12:51 -0600 Subject: [PATCH] Add function to alter autoincrement value in custom code --- .../tag1_migration/tag1_migration.module | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 drupal10/web/modules/custom/tag1_migration/tag1_migration.module diff --git a/drupal10/web/modules/custom/tag1_migration/tag1_migration.module b/drupal10/web/modules/custom/tag1_migration/tag1_migration.module new file mode 100644 index 0000000..332eab5 --- /dev/null +++ b/drupal10/web/modules/custom/tag1_migration/tag1_migration.module @@ -0,0 +1,47 @@ + 450, + 'node_revision' => 1000, + // Drupal 10 class: \Drupal\user\Entity\User + // Drupal 7 tables: users + 'users' => 350, + // Drupal 10 class: \Drupal\taxonomy\Entity\Term + // Drupal 7 tables: taxonomy_term_data + 'taxonomy_term_data' => 200, + 'taxonomy_term_revision' => 200, + // Drupal 10 class: \Drupal\path_alias\Entity\PathAlias + // Drupal 7 tables: url_alias, node, node_revision, users, and taxonomy_term_data + 'path_alias' => 1000, + 'path_alias_revision' => 1000, + // Drupal 10 class: \Drupal\file\Entity\File + // Drupal 7 tables: file_managed + 'file_managed' => 350, + // Drupal 10 class: \Drupal\media\Entity\Media + // Drupal 7 tables: file_managed, node, and node_revision + 'media' => 1000, + 'media_revision' => 1000, + // Drupal 10 class: \Drupal\paragraphs\Entity\Paragraph + // Drupal 7 tables: paragraphs_item and paragraphs_item_revision + 'paragraphs_item' => 750, + 'paragraphs_item_revision' => 750, + // Drupal 10 class: \Drupal\menu_link_content\Entity\MenuLinkContent + // Drupal 7 tables: menu_links + 'menu_link_content' => 500, + 'menu_link_content_revision' => 500, + ]; + + foreach ($auto_increment as $table => $new_value) { + \Drupal::database()->query(\sprintf('ALTER TABLE {%s} AUTO_INCREMENT = %s;', $table, $new_value)); + } +}