I’m using postgresql, I found some problems when running unittest.
file: db/migrate/001_create_post.rb:
class CreatePosts < ActiveRecord::Migration
def self.up
execute <<-EOS
create table posts (
id serial not null primary key,
title varchar(255),
created_at timestamp not null default current_timestamp
);
EOS
end
def self.down
drop_table :posts
end
end
when execute “rake migrate”, no problem.
but execute “rake db:test:prepare”, the default value “default
current_timestamp” not apply to field “created_at”.