bmrrossi / c5-db-migration

Automatically exported from code.google.com/p/c5-db-migration
0 stars 0 forks source link

Fail if a migration doesn't end in a delimiter #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a migration that like so:
INSERT INTO foo (bar) VALUES (1)
2. Note the lack of delimiter
3. Try to apply the migration.  Notice that it doesn't apply and is
silently ignored.

What is the expected output? What do you see instead?
Some kind of a warning that I've got an unterminated command or the command
to just execute.  Either or is fine with me.

What version of the product are you using? On what operating system?
0.9.8 with MySQL on Ubunutu 9.10

Please provide any additional information below.
I'm migrating from a home grown tool that would just apply the outstanding
command even if it was missing the delimiter.  I'm using the attached patch
to hunt down the delimiters.

Original issue reported on code.google.com by nik9...@gmail.com on 23 Nov 2009 at 2:21

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by christia...@gmail.com on 15 Dec 2009 at 5:28

GoogleCodeExporter commented 8 years ago
One of the early guiding principles has been that you should be able to execute 
a sql 
migration using the native db command line tools.  This makes it easier to 
write 
them, test them, and to know what's allowed in them.  As a result, I'm 
interested in 
replicating the behavior of the most common databases.  This will help me 
decide 
whether this should report an error or warning.

From the command line, MySQL executes all of the statements in a script, even 
if the 
last statement If a multi-statement script does _not_ have a delimiter.  It 
does so 
silently.  Naturally, only the last statement can get away without its 
delimiter.

I'm going to check postgresql too before committing the fix.  I'm leaning 
towards just 
accepting the script if it's missing the last deliminator, executing all of the 
statements (including the last one), and report an info or warn level message 
if it 
happens.

Thanks!
Christian

Original comment by christia...@gmail.com on 26 Dec 2009 at 5:36

GoogleCodeExporter commented 8 years ago
Just deployed 0.9.9-SNAPSHOT which includes the fix for this... give it a whirl 
and let 
me know if it works as expected.  Merry Christmas! :)

Original comment by christia...@gmail.com on 26 Dec 2009 at 6:16

GoogleCodeExporter commented 8 years ago
Thanks!  I'll test it on my inputs early next week.  I've had to put the 
delimiters on 
them to get them working but I'll take one off just to check.

Original comment by nik9...@gmail.com on 26 Dec 2009 at 12:28