Displaying 1 result from an estimated 1 matches for "sndx".
Did you mean:
sdx
2006 Aug 22
5
Creating mysql triggers with migrations blows up
def self.up
execute("delimiter ^ ")
sql = <<-_SQL
CREATE TRIGGER customer_bi BEFORE INSERT ON customers
FOR EACH ROW
BEGIN
SET NEW.sndx = SOUNDEX(NEW.lname) ;
END ^
_SQL
sql.split(''^'').each do |stmt|
execute(stmt) if (stmt.strip! && stmt.length > 0)
end
execute("delimiter ; ")
end
Blows up with this message:
Mysql::Error: You have an error in your SQL syntax...