방금 작성한 빈 MySQL 데이터베이스가 있습니다. south
은 (는) INSTALLED_APPS
에 있습니다.사우스 마이 그 레이션이 실패하는 이유는 무엇입니까?
나는 실행
$ ./manage.py syncdb
...
Creating table some_app_table
You just installed Django's auth system, which means you don't have any superusers defined.
...
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Synced:
> django.contrib.auth
> django.contrib.contenttypes
...
Not synced (use migrations):
- myapp
...
$ ./manage.py schemamigration myapp --initial
+ Added model myapp.Model
...
Created 0003_initial.py. You can now apply this migration with: ./manage.py migrate myapp
$ ./manage.py migrate myapp
Running migrations for myapp:
- Migrating forwards to 0003_initial.
> skan:0001_initial
> skan:0002_initial
FATAL ERROR - The following SQL query failed: CREATE TABLE `myapp_model` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `user_id` integer NULL, `name` varchar(200) NOT NULL);
The error was: (1050, "Table 'myapp_model' already exists")
을 무슨 일이야? 왜 남반구가 올바르게 초기화되지 않습니까?
'--initial'은 초기 테이블을 생성하는 데 사용되어야한다; 이미 myapp_model 테이블을 생성했다. – geoffspear
가능한 경우 데이터베이스를 다시 만들고 syncdb를 실행하지 않고 처음 초기화를 다시 실행하십시오. – Mikael
@wooble 명령을 실행하기 전에 테이블이 존재하지 않습니다 – fredley