1. timestamp로 만들 칼럼에 default 값이 없어서 에러가 나는가보다
$table->timestamp('reg_dt')->useCurrent();
$table->timestamp('upd_dt')->useCurrent();
로 수정
2. default current time은 한 테이블당 한 칼럼밖에 안되나보다
$table->timestamp('upd_dt')->nullable(true);
로 수정 null 값 허용
3. 칼럼 관련 문제가 없어지니 외래키 설정 문제가 일어남
참고
http://jason-heo.github.io/mysql/2014/03/05/fk-error-150.html
외래키를 설정할때 칼럼들 조건
1. 참조되는 테이블의 칼럼(A)과 참조하는 테이블의 칼럼(B)의 타입이 같아야함
2. A의 칼럼은 primary key 또는 unique key 이어야함
3. B의 칼럼은 index여야함
4. B의 칼럼은 on delete(update) cascade set null 시 not null이 아니어야함
type 테이블
$table->unique('type_num'); 추가
위에꺼 다하고
php artisan migrate:fresh 하니까 다됨
'일지' 카테고리의 다른 글
10/1 tinker (0) | 2021.10.01 |
---|---|
9/27 (0) | 2021.09.27 |
9/24 한글 해결 못하고 있음 (0) | 2021.09.24 |
9/23 재부팅 시 iptables / locale (0) | 2021.09.23 |
9/22 centos7 한글 입력기 (0) | 2021.09.23 |