0
MySQL 기반 Django 프로젝트를 PostgreSQL로 마이그레이션하려고합니다. 불행히도 settings.py에서 데이터베이스 백엔드를 전환하자마자 모든 sql/syncdb 명령이 실패합니다. PostgreSQL 백엔드에서 Django sql/syncdb 명령이 실패합니다.
python manage.py sql profile
BEGIN;
CREATE TABLE `profile_department` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` varchar(100) NOT NULL UNIQUE,
[...]
python manage.py sql profile
/PostgreSQL을 (psycopg2) :
DatabaseError: relation "profile_department" does not exist
LINE 1: ...nt"."homepage", "profile_department"."gd_id" FROM "profile_d...
^
왜 장고는 두 DB 백엔드와 다르게 행동 하는가?
ROOT_DEPARTMENT = Department.objects.get(pk=14)
FACULTIES = Department.objects.filter(parent=ROOT_DEPARTMENT)
감사 :
데이터베이스를 볼 때 테이블이 있습니까? –
Postgres 용으로 실행되는'create table' 문을 보여주십시오 (** 게시 한 ** 아닙니다 **). –
SQL을 생성 할 때 DB에서 쿼리하는 이유는 무엇입니까? 모듈로드를 트리거하는 쿼리가있는 것처럼 보입니다 ... tut tut ... – Thomas