나의 재물운? 연애운은?
AI가 봐주는 내 사주팔자 - 운세박사
위와 같이 BigSerial 포맷으로 추가하면 알아서 생김
추가적인 것은 아래 링크 참고
https://stackoverflow.com/questions/48446399/sql-auto-increment-pgadmin-4
장고에서 Primary Key가 없는 데이터베이스에 외래키를 생성하려고 보니 해당 이슈가 발생됨
django.db.utils.ProgrammingError: there is no unique constraint matching given keys for referenced table "digital_relations"
위의 방법으로 DB에서 추가해준다
이미 존재하는 데이터베이스를 Django 모델로 만들고 그 모델에 내가 추가로 만든 모델에서 외래키로 등록하려고 할 때 원래 DB에 Primary Key가 없을 경우에는 PGAdmin에서 생성해줘야함. 아래와 같은 오류가 날 것이다.
django.db.utils.ProgrammingError: there is no unique constraint matching given keys for referenced table
그리고 특히나 다중 데이터베이스를 쓸 때에 Foreign key를 장고에서 지정해줄 때에는 아래 포스트를 보자
django foreign key different database
https://hangpark.com/django-multi-db-relation/
나의 재물운? 연애운은?
AI가 봐주는 내 사주팔자 - 운세박사