#469 ✓resolved
Bryan Ray

Using dm-is-state_machine causes invalid SQL syntax error

Reported by Bryan Ray | July 18th, 2008 @ 06:08 PM

Simply including the dm-is-state_machine plugin and then declaring an is :state_machine reference in a model will render this error when you run "rake dm:db:automigrate":

~ You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'new, `post_id` INT(11), PRIMARY KEY(`id`)) ENGINE = InnoDB CHARACTER SET utf8 CO' at line 1

rake aborted!

Comments and changes to this ticket

  • Bernerd Schaefer

    Bernerd Schaefer July 22nd, 2008 @ 12:36 PM

    • State changed from “new” to “resolved”

    Thanks for finding this, Bryan. It had to do with the :initial value being a symbol, and getting passed to mysql without quotes.

    As of 22ddfae, dm-is-state_machine calls to_s on the initial value passed in. If you are on the gem, then you should just need to change :initial => :new to :initial => "new".

  • Bryan Ray

    Bryan Ray July 22nd, 2008 @ 12:40 PM

    Perfect. Thanks for the fix.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages