Getting rid of database names in exported SQL?

lemon_juice's profile image lemon_juice posted 8 years ago in General Permalink

Could we have an option to get rid of database names in exported SQL dumps:

-- Dumping structure for table dbname.table
-- Dumping structure for view dbname.view
-- Dumping structure for function dbname.func
-- Dumping structure for event dbname.event

... and probably some other similar comments for procedures and other objects?

I know these names are in comments but sometimes I need to compare database structure between development and production servers so I export both databases without data and use an external program to see the differences. Most often the database names are different between the development and production and therefore I see unnecessary changes in the diff for all database objects and it's more difficult to find the real differences. Could something be done about it?

Personally, I don't see any sense in those comments at all - when I see a CREATE TABLE command in the dump it's obvious that this is table structure, I don't need a comment "Dumping structure for table...". But I don't mind if they stay as long as they don't interfere with diffs.

ansgar's profile image ansgar posted 8 years ago Permalink

Well, the comments were never topic of a discussion until now. But I understand the issue here. Perhaps we want to have some drop-down button in the export dialog with checkable menu items (= true/false settings). "Create comments" could be one option in that drop down, so you can disable comments entirely. Would that help? And that drop-down is open for other suggessted true/false settings.

Code modification/commit from ansgarbecker, 8 years ago, revision 9.3.0.5041
Add new "Options" dropdown button on SQL export dialog, and two new true/false settings: "Add comments" and "Remove auto_increment clauses".
* see http://www.heidisql.com/forum.php?t=18727#p18729
* see http://www.heidisql.com/forum.php?t=20363#p20373
ansgar's profile image ansgar posted 8 years ago Permalink

See the new "Options" dropdown button in r5041

lemon_juice's profile image lemon_juice posted 8 years ago Permalink

Thanks, these options are great!

The only minor thing - could you leave a newline between object definitions like CREATE TABLE...? Readability is reduced when all SQL commands are without any space between them like in r5041.

ansgar's profile image ansgar posted 8 years ago Permalink

r5042 comes with some new lines in both with/without comments modes.

lemon_juice's profile image lemon_juice posted 8 years ago Permalink

Now it's perfect! Very useful options, thanks.

Please login to leave a reply, or register at first.