Reputation: 20862
When I have to run database migration scripts, I tend to exercise a large degree of paranoia and not run the script all at once like dbcli < migration.sql
. Instead, I prefer to run the commands one-at-a-time. So far, I've just been using copy/paste which is miserable.
There has to be a tool that can do this kind of thing, but I'm having a hard time finding one using Google, Wikpedia, or StackOverflow (close but no cigar).
This is definitely something I could write myself, but it just has to exist already, doesn't it?
This really needs to be something that can be run from a command-line with a tiny bit of interactivity (like display the statement that will be executed, let you press e.g. ENTER to execute it, then show you the output if there is any) since servers usually don't have any GUI available.
My specific db target is MySQL but there's no need for such a tool to be db-specific.
Update
Meanwhile, I'm writing a utility in Java that will do what I want.
Upvotes: 1
Views: 2354
Reputation: 31
Flyway Teams Edition (commercial license) also supports executing statements one by one under Stream parameter. This is not an exact answer to your question, but it can at least give you information about existing tools.
Upvotes: 0
Reputation: 20862
Long ago, I wrote my own tool for this purpose, and have been using and perfecting it over time. Feel free to use it and offer suggestions for features, etc.
Upvotes: 0
Reputation: 16680
Oracle SQL Developer will run one line at a time as long as it's ended with a semi-colon.
You can connect to certain 3rd party databases with additional drivers (http://www.oracle.com/technetwork/products/migration/omwb-getstarted-093461.html)
Upvotes: 1
Reputation: 1037
Emacs' SQL mode supports sending line by line, region by region and file by file.
Of course, you have to learn emacs, but it does do what you want.
Upvotes: 0
Reputation: 56769
You could try dbForge. There is a free Express Edition, but I can't quite tell from the feature comparison list if it allows you to step through arbitrary SQL scripts.
Upvotes: 0