Currently the modules exposes a auto_increment_alter.mysql service to perform different AUTO_INCREMENT alter operations. The examples make use of `drush php:eval` to call the service.

Let's create Drush commands so there is no need to manually invoke the services. Example:

drush auto-increment-alter:table node 500
drush auto-increment-alter:tables
drush auto-increment-alter:alter-content-entities

Note that the AutoIncrementAlterInterface interface has more methods not covered by the examples above.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dinarcon created an issue. See original summary.

gaurav_manerkar’s picture

Assigned: Unassigned » gaurav_manerkar

gaurav_manerkar’s picture

Assigned: gaurav_manerkar » Unassigned
Status: Active » Needs review

Pls review.
Thanks

dinarcon’s picture

Status: Needs review » Postponed

Thanks for working on this @gaurav_manerkar

Drush 11 and prior required dependency injection via a drush.services.yml file. This approach is deprecated in Drush 12+ and removed in Drush 13. See https://www.drush.org/13.x/dependency-injection/ While Drush 11 could work with Drupal 10, that version has been EOL for about a year. Let's not use services files. See https://www.drush.org/13.x/commands/ for the recommended way to author Drush commands.

Also, a few new methods are being worked on. Once the following issues land, let's add Drush commands for the methods introduced in them:

dinarcon’s picture

Title: Provide Drush commands for different AUTO_INCREMENT alter operations » Provide Drush commands for all public methods in the AutoIncrementAlterInterface interface
Issue summary: View changes
Status: Postponed » Needs work
gaurav_manerkar’s picture

Status: Needs work » Needs review

Updated drupal commands and README file.
Pls review, Thanx.

dinarcon’s picture

Status: Needs review » Needs work

Great work @gaurav_manerkar! A few things I would like to include before merging.

  • Rename the ignore-auto-increment-column option of the getAllTableAutoIncrementValues command to unfiltered.
  • No need to provide validation for the entity group/type in getEntityList.
  • Change group in getEntityList from argument to option.

Once the changes are implemented, let's update the README.md accordingly.

gaurav_manerkar’s picture

Status: Needs work » Needs review

done

baltowen made their first commit to this issue’s fork.

baltowen’s picture

I tested all commands and they work as expected. @dinarcon asked to rename the ignore-auto-increment-column option to unfiltered, but the actual name only-with-auto-increment-column was different from the instruction. As a suggestion it would be better to rename this option to all, since it's concise and clear to understand.

dinarcon’s picture

Status: Needs review » Fixed

Thanks @baltowen and @gaurav_manerkar for working on this! After implementing the suggestion to use --all as the option name, I reviewed and updated other function names and parameters. I also updated the Drush command names and included shorter aliases.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.