Skip to content

Commit

Permalink
Add --quick option to project dump command
Browse files Browse the repository at this point in the history
Fixes #461

Add support for the --quick option in the project dump command.

* Add a new flag `--quick` to the `projectDatabaseDumpCmd` command.
* Pass the `--quick` option to the `database.NewMySQLDumper` function when the `--quick` flag is set.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/shopware/shopware-cli/issues/461?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
shyim committed Feb 1, 2025
1 parent 304a6d1 commit 9fd67b6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/project/project_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var projectDatabaseDumpCmd = &cobra.Command{
skipLockTables, _ := cmd.Flags().GetBool("skip-lock-tables")
anonymize, _ := cmd.Flags().GetBool("anonymize")
compression, _ := cmd.Flags().GetString("compression")
quick, _ := cmd.Flags().GetBool("quick")

db, err := sql.Open("mysql", mysqlConfig.FormatDSN())
if err != nil {
Expand All @@ -61,11 +62,15 @@ var projectDatabaseDumpCmd = &cobra.Command{
opt = append(opt, database.OptionValue("skip-lock-tables", "1"))
}

if quick {
opt = append(opt, database.OptionValue("quick", "1"))
}

logger, _ := zap.NewProduction()
dumper, err := database.NewMySQLDumper(db, logger, service, opt...)
if err != nil {
return err
}
}

Check failure on line 73 in cmd/project/project_dump.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gofmt)

pConf := core.Rules{Ignore: []string{}, NoData: []string{}, Where: map[string]string{}, Rewrite: map[string]core.Rewrite{}}

Expand Down Expand Up @@ -333,4 +338,5 @@ func init() {
projectDatabaseDumpCmd.Flags().Bool("anonymize", false, "Anonymize customer data")
projectDatabaseDumpCmd.Flags().String("compression", "", "Compress the dump (gzip, zstd)")
projectDatabaseDumpCmd.Flags().Bool("zstd", false, "Zstd the whole dump")
projectDatabaseDumpCmd.Flags().Bool("quick", false, "Use quick option for mysqldump")
}

0 comments on commit 9fd67b6

Please sign in to comment.