之前為了省事,數(shù)據(jù)庫配置如下:
正常運(yùn)行沒什么問題。后來發(fā)現(xiàn)在運(yùn)行rake test作單元測試時會報錯,把拷貝過來就沒有問題。不過rubyonrails.com上不允許匿名提交bug,還真麻煩。
另外發(fā)現(xiàn)config.active_record.schema_format = :ruby配置下,postgresql的timestamp字段默認(rèn)值current_timestamp不能正確復(fù)制到數(shù)據(jù)庫。經(jīng)檢查它是使用db:schema:dump復(fù)制下數(shù)據(jù)庫模式,再使用db:schema:load生成測試數(shù)據(jù)庫模式的,這個模塊為了各數(shù)據(jù)庫統(tǒng)一,會去掉那些不一致的默認(rèn)值。解決辦法是設(shè)置config.active_record.schema_format = :sql。
development_pgsql:
??adapter:?postgresql
??database:?myproject_development
??username:?postgres
??password:?
development_mysql:
??adapter:?mysql
??database:?myproject_development
??username:?root
??password:?
development:
??development_mysql
test:
??adapter:?postgresql
??database:?myproject_test
??username:?postgres
??password:?
production:
??development
??adapter:?postgresql
??database:?myproject_development
??username:?postgres
??password:?
development_mysql:
??adapter:?mysql
??database:?myproject_development
??username:?root
??password:?
development:
??development_mysql
test:
??adapter:?postgresql
??database:?myproject_test
??username:?postgres
??password:?
production:
??development
正常運(yùn)行沒什么問題。后來發(fā)現(xiàn)在運(yùn)行rake test作單元測試時會報錯,把拷貝過來就沒有問題。不過rubyonrails.com上不允許匿名提交bug,還真麻煩。
另外發(fā)現(xiàn)config.active_record.schema_format = :ruby配置下,postgresql的timestamp字段默認(rèn)值current_timestamp不能正確復(fù)制到數(shù)據(jù)庫。經(jīng)檢查它是使用db:schema:dump復(fù)制下數(shù)據(jù)庫模式,再使用db:schema:load生成測試數(shù)據(jù)庫模式的,這個模塊為了各數(shù)據(jù)庫統(tǒng)一,會去掉那些不一致的默認(rèn)值。解決辦法是設(shè)置config.active_record.schema_format = :sql。