schema_migrations
테이블에 올바른 스키마가 있습니까? psql
에 가서 할 :이 표시되어야합니다
> \d schema_migrations
:
Table "public.schema_migrations"
Column | Type | Modifiers
---------+------------------------+-----------
version | character varying(255) | not null
Indexes:
"unique_schema_migrations" UNIQUE, btree (version)
또는 거의 그.
그런 것처럼 보일 경우 db:migrate
은 여전히 모든 마이그레이션을 실행하기를 원할 것입니다. 그렇다면 열 값이나 이와 유사한 일부 빈 공간이있을 수 있습니다. 문제를 해결하기 위해 더 많은 시간을 낭비하거나 손으로 다시 작성하고 더 재미있는 활동으로 넘어갈 수 있습니다. psql
에서 :
이
$ for m in *.rb; do printf "insert into schema_migrations (version) values ('%s');\n" $(echo $m | sed 's/_.*//');done | psql -h your_host -U your_user -d your_db
당신은 -h
, -U
에 대한 올바른 값을 제공해야하고, -d
: 당신의 마이그레이션 디렉토리에서 다음
> drop table schema_migrations;
> create table schema_migrations (
version varchar(255) not null,
constraint unique_schema_migrations unique (version)
);
와 (당신이 뭔가 Unixy에있어 가정) 물론 스위치.