我运行了python manage.py makemigrations core
,它在/ opt / project / core / migrations中创建了以下文件
0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('company', models.CharField(max_length=100)),
('department', models.CharField(max_length=100)),
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
],
options={
},
bases=(models.Model,),
),
]
然后我运行python manage.py migrate
并且它什么也没做。它不是在数据库中创建表。
运行python manage.py sqlmigrate core
不会返回任何内容。
我使用postgres作为我的后端数据库db1
,架构是core
。