Is there away to have parts of a migration file only work with a specific database. For example I am inserting some data into a table with: execute "INSERT INTO demo_lists(position, name, updated_at, created_at) VALUES (1, 1, ''scott'', CURDATE(), CURDATE());" Of course the curdate() function may only be available on mysql. So can we some how determine which database type Migrations is working on? I would assume there''s away since my Migrations class extends ActiveRecord. thanks, scott. ---------------------------------------------------------------------------------------------------- What''s an Intel chip doing in a Mac? A whole lor more that it''s ever done in a PC. My Digital Life - http://scottwalter.com/blog Pro:Blog - http://scottwalter.com/problog -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060215/3ea0a3af/attachment.html
On Feb 15, 2006, at 1:02 PM, Scott Walter wrote:> Is there away to have parts of a migration file only work with a > specific database. For example I am inserting some data into a > table with: > > execute "INSERT INTO demo_lists(position, name, updated_at, > created_at) VALUES (1, 1, ''scott'', CURDATE(), CURDATE());" > > Of course the curdate() function may only be available on mysql. > So can we some how determine which database type Migrations is > working on? I would assume there''s away since my Migrations class > extends ActiveRecord.Embrace the object relational goodness. DemoList.create( :position => 1, :name => ''scott'' ) created_at and updated_at are magically, and are set automatically. -- -- Tom Mornini