Hi,
I think this is a bug, but I'm not too familiar with MySQL (I mostly
use Postgresql). I'm quite unable to use foreign keys in MySQL because
I get a syntax error when I run the migrations. I've created a
stripped down minimal example on how to reproduce this. I tested
against the current GitHub source and it's doing this currently.
Create a MySQL database and run the following two migrations:
001_authors.rb:
class CreateAuthors < Sequel::Migration
def up
create_table :authors, :engine => 'InnoDB' do
primary_key :id
varchar :name
end
end
end
002_posts.rb:
class CreatePosts < Sequel::Migration
def up
create_table :posts, :engine => 'InnoDB' do
foreign_key :author_id, :table => :authors
text :content
end
end
end
You will get the following result:
" Mysql::Error: Can't create table 'testing.posts' (errno: 150) "
run mysql and type the following:
mysql> show innodb status;
you will see that the most recent error is a syntax error something like:
------------------------
LATEST FOREIGN KEY ERROR
------------------------
100208 12:02:20 Error in foreign key constraint of table
testing/posts:
FOREIGN KEY (`author_id`) REFERENCES `authors`, `content` text)
ENGINE=InnoDB:
Syntax error close to:
, `content` text) ENGINE=InnoDB
Any advice greatly appreciated,
Thanks,
Clive
--
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.