Skip to content

Commit

Permalink
Revert changes to mysqldump
Browse files Browse the repository at this point in the history
  • Loading branch information
Andriiklymiuk committed Jul 23, 2024
1 parent 0ecb5f1 commit 09c7cce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
)

var APP_VERSION = "1.6.8"
var APP_VERSION = "1.6.9"

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion templates/mariadbTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ id:
seed:
cat dump.sql | docker exec -i $(c) mysql -u{{.User}} -p{{.Password}} {{.DatabaseName}}
{{if .SeedFromDb.Host}}getDump:
mysqldump --host={{.SeedFromDb.Host}} --port={{.SeedFromDb.Port}} --user={{.SeedFromDb.User}} --password='$${p}' {{.SeedFromDb.DatabaseName}} > dump.sql
mysqldump --host={{.SeedFromDb.Host}} --port={{.SeedFromDb.Port}} --user={{.SeedFromDb.User}} --password=$(p) {{.SeedFromDb.DatabaseName}} > dump.sql
{{end}}getSelfDump:
mysqldump --host={{.Host}} --port={{.Port}} --user={{.User}} --password=$(p) {{.DatabaseName}} > dump.sql
remove:
Expand Down
7 changes: 3 additions & 4 deletions templates/mysqlTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ stop:
id:
docker ps -aqf "name=mysql-{{.ServiceName}}" | awk '{print $1}'
seed:
cat dump.sql | docker exec -i $$(shell docker ps -aqf "name=mysql-{{.ServiceName}}") mysql -uroot -p'{{.Password}}' {{.DatabaseName}}
cat dump.sql | docker exec -i $(shell docker ps -aqf "name=mysql-{{.ServiceName}}") mysql -uroot -p{{.Password}} {{.DatabaseName}}
{{if .SeedFromDb.Host}}getDump:
@if [ -z "$${p}" ]; then echo "Error: Password not provided. Use 'make getDump p=your_password'"; exit 1; fi
mysqldump --host={{.SeedFromDb.Host}} --port={{.SeedFromDb.Port}} --user={{.SeedFromDb.User}} --password='$${p}' {{.SeedFromDb.DatabaseName}} > dump.sql
mysqldump --host={{.SeedFromDb.Host}} --port={{.SeedFromDb.Port}} --user={{.SeedFromDb.User}} --password='$(p)' {{.SeedFromDb.DatabaseName}} > dump.sql
{{end}}getSelfDump:
mysqldump --host={{.Host}} --port={{.Port}} --user={{.User}} --password='$${p}' {{.DatabaseName}} > dump.sql
mysqldump --host={{.Host}} --port={{.Port}} --user={{.User}} --password=$(p) {{.DatabaseName}} > dump.sql
remove:
docker rm --volumes mysql-{{.ServiceName}}
logs:
Expand Down

0 comments on commit 09c7cce

Please sign in to comment.