Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Junk databases tables schemas #180

Open
maetx777 opened this issue Apr 12, 2022 · 0 comments
Open

Junk databases tables schemas #180

maetx777 opened this issue Apr 12, 2022 · 0 comments

Comments

@maetx777
Copy link

Hi!
When I run utility, I will set up --database flag with database name, same from connStr
But, on main.go line 229 you will check database name, otherwise too many schemas collected in the dbTables variable, and when I have some copies of my database (application, application_dev, application_test), names of tables from this databases has conflicts.
See my change:

	var dbTables []string
	// parse or read tables
	if *sqlTable != "" {
		dbTables = strings.Split(*sqlTable, ",")
	} else {
		schemaTables, err := schema.TableNames(db)
		if err != nil {
			fmt.Print(au.Red(fmt.Sprintf("Error in fetching tables information from %s information schema from %s\n", *sqlType, *sqlConnStr)))
			os.Exit(1)
			return
		}
		for _, st := range schemaTables {
			//We need only one database schema <<<
			if st[0] != *sqlDatabase {
				continue
			}
			dbTables = append(dbTables, st[1]) // s[0] == sqlDatabase
		}
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant