I dunno if I've found a bug or... what.

I have the following migration:

create_table :assets do
  primary_key :id
  foreign_key :type_id, :types, :null => false
  String :name, :length => 255, :null => false
  String :slug, :length => 255, :null => false
  DateTime :date_created, :null => false
  DateTime :date_modified, :null => false
  Fixnum :precedence, :default => 1, :null => false
  text :description, :null => false
  text :notes, :null => false
end

The types table is already created and working fine. Here's the SQL
this migration generates:

CREATE TABLE `assets` (`id` integer PRIMARY KEY AUTO_INCREMENT,
`type_id` integer NOT NULL, FOREIGN KEY (`type_id`) REFERENCES
`types`, `name` varchar(255) NOT NULL, `slug` varchar(255) NOT NULL,
`date_created` datetime NOT NULL, `date_modified` datetime NOT NULL,
`precedence` integer NOT NULL DEFAULT 1, `description` text NOT NULL,
`notes` text NOT NULL) ENGINE=InnoDB

Unfortunately, that produces the following error:

ERROR 1005 (HY000): Can't create table './database/assets.frm' (errno:
150)

The syntax should be:

CREATE TABLE `assets` (`id` integer PRIMARY KEY AUTO_INCREMENT,
`type_id` integer NOT NULL, FOREIGN KEY (`type_id`) REFERENCES `types`
(`id`), `name` varchar(255) NOT NULL, `slug` varchar(255) NOT NULL,
`date_created` datetime NOT NULL, `date_modified` datetime NOT NULL,
`precedence` integer NOT NULL DEFAULT 1, `description` text NOT NULL,
`notes` text NOT NULL) ENGINE=InnoDB

The difference is hard to notice, but "REFERENCES `types`" becomes
"REFERENCES `types` (`id`)". Am I doing something wrong in my syntax
or is this a bug?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to