Ahh I think that answers my next question... should migrations
rollback on failure like they do on postgresql, I think the answer is
no for mysql...
I am trying to get my client to switch to postgresql so I can avoid
these issues.
Ok the workaround I used for now which makes my migrations now work on
postgresql and mysql (except for rollbacks) is to do the following
which seems to work ok...
instead of...
DB.run(sql1)
I do...
sql1.split(';').each { |s| DB.run(s) }
Thanks for your help, I look forward to seeing if mysql2 works better.
although I think this is actually a mysql client library problem and
not a ruby problem.
On May 27, 5:01 pm, Jeremy Evans <[email protected]> wrote:
> On May 27, 4:38 pm, Jim Morris <[email protected]> wrote:
>
> > Well that's not very good :) It works fine with postgresql, so any
> > workarounds would probably not be database agnostic.
>
> > There is no reason for mysql to return that error, as INSERTS are not
> > supposed to return anything.
>
> MySQL does something stupid, news at 11. :)
>
> > Sequels handling of this error (which happens in a migration) is also
> > bad IMHO because it kills the connection the migration is not rolled
> > back, so the version is left at zero but all the tables are left
> > intact, leaving the migration in a bad state.
>
> There is no way for Sequel to keep working on a connection where the
> commands are out of sync. It doesn't know why the connection got out
> of sync or how to fix it, so the only safe play is to disconnect.
> Naturally, if you were using a better database that supported
> transactional schema modifications (e.g. PostgreSQL), a dropped
> connection would rollback the transaction.
>
> > I'm not a mysql expert I prefer postgresql (and now even more!), so
> > I'm not likely to be able to debug this for the mysql people.
>
> > Is there a place I can report ruby-mysql bugs?
>
> http://rubyforge.org/projects/mysql-ruby/
>
> You may want to try Mysql2 (http://github.com/brianmario/mysql2), and
> see if you have more luck with that. I plan on including its Sequel
> adapter with Sequel after the Mysql2 author gives me the OK. However,
> if this is truly a MySQL issue and not a ruby-mysql one, it's unlikely
> to have an effect.
>
> Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.