注意:使用Rails 3.0.7,Postgresql 8.4.4-1,rake 0.8.7。rake db:test:准备不创建所有表
试图让轨测试工作。
命令耙分贝:测试:准备的似乎做工精细 -
$ rake db:test:prepare -t (in /home/beau/looked) ** Invoke db:test:prepare (first_time) ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:abort_if_pending_migrations ** Execute db:test:prepare ** Invoke db:test:load (first_time) ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge ** Execute db:test:load ** Invoke db:schema:load (first_time) ** Invoke environment ** Execute db:schema:load NOTICE: CREATE TABLE will create implicit sequence "slugs_id_seq" for serial column "slugs.id" NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index "slugs_pkey" for table "slugs"
但有些表没有被创建。
这些 “发展” 的表:DB:由耙创建
$ psql -d looked -U admin -c '\d' List of relations Schema | Name | Type | Owner --------+-------------------+----------+------- public | businesses | table | admin public | businesses_id_seq | sequence | admin public | categories | table | admin public | categories_id_seq | sequence | admin public | schema_migrations | table | admin public | slugs | table | admin public | slugs_id_seq | sequence | admin (7 rows)
表测试环境准备 -
$ psql -d looked_test -U admin -c '\d' List of relations Schema | Name | Type | Owner --------+-------------------+----------+------- public | categories | table | admin public | schema_migrations | table | admin public | slugs | table | admin public | slugs_id_seq | sequence | admin (4 rows)
正如你可以看到它也产生了一些表,但不是企业,business_id_seq或categories_id_seq。
我不知道为什么,有人可以帮助我吗?
你的模式文件是什么样的? 'RAILS_ROOT/db/schema.rb' – 2011-05-03 12:44:36
你的'schema.rb'文件是什么样的? – 2011-05-03 12:44:59
好吧,我刚刚检查过,模式文件中的某些表中缺少这些表。 – 2011-05-03 12:49:20