참고 : Rails 3.0.7, PostgreSQL 8.4.4-1, rake 0.8.7을 사용하십시오.rake db : test : 모든 테이블을 만들지 마십시오.
레일 테스트 작동을 시도 중입니다.
명령 레이크 dB : 시험 : 잘 작동이 나타납니다 준비 -
$ 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' –
'schema.rb' 파일은 어떻게 생겼습니까? –
OK 방금 확인한 결과 테이블이 스키마 파일에서 누락되었습니다. –