> Chris: if you have something you're comfortable sharing, I'd love to see an 
> example of how you're using dm-migrations with hand-written DDL. I'm about to 
> embark on that soon myself, and working examples would be helpful!
> 

I could, but I'm literally just using #execute, which dm-migrations provides ;) 
 I'm not strongly opposed to an auto-generated schema, but our site has a 
pretty large database so want to know exactly what our schema is created as.  
Migrations are the only place I actively encourage the use of SQL with my 
colleagues and everywhere else I urge them to use DM's ORM where possible.

If you were adding an ENUM field it would just be:

migration 2, :create_posts_table do
  up do
    execute(<<-SQL)
    CREATE TABLE posts (
      id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
      title VARCHAR(255) NOT NULL,
      status ENUM('draft', 'published', 'deleted') NOT NULL DEFAULT 'draft'
    ) ENGINE=InnoDB CHARSET=utf8
    SQL
  end
  
  down do
    drop_table :posts
  end
end


-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en.

Reply via email to