Django e postgres "DETAIL: Ключ (поле)=() дублируется"

Я делал миграции в моей базе данных, и я получил эту ошибку:

(env)$ python manage.py migrate Проверка системы выявила некоторые проблемы:

мои миграции

(env) lucas@ubuntu-s-1vcpu-1gb-nyc1-01:~/MaxiLimpService$ python manage.py showmigrations

System check identified some issues:

        
account
 [X] 0001_initial
 [X] 0002_email_max_length
 [X] 0003_auto_20210712_1617
admin
 [X] 0001_initial
 [X] 0002_logentry_remove_auto_add
 [X] 0003_logentry_add_action_flag_choices
auth
 [X] 0001_initial
 [X] 0002_alter_permission_name_max_length
 [X] 0003_alter_user_email_max_length
 [X] 0004_alter_user_username_opts
 [X] 0005_alter_user_last_login_null
 [X] 0006_require_contenttypes_0002
 [X] 0007_alter_validators_add_error_messages
 [X] 0008_alter_user_username_max_length
 [X] 0009_alter_user_last_name_max_length
 [X] 0010_alter_group_name_max_length
 [X] 0011_update_proxy_permissions
 [X] 0012_alter_user_first_name_max_length
cadastro
 (no migrations)
consulta
 (no migrations)
contenttypes
 [X] 0001_initial
 [X] 0002_remove_content_type_name
editar
 (no migrations)
localDeTrabalho
 (no migrations)
models
 [X] 0001_initial
 [X] 0002_auto_20210706_1002
 [X] 0003_auto_20210708_0922
 [X] 0004_alter_funcionario_id_unidade
 [X] 0005_horarioservico_unidade
 [X] 0006_alter_horarioservico_unidade
 [X] 0007_alter_horarioservico_data_horario_servico
 [X] 0008_auto_20210727_1737
 [X] 0009_alter_horarioservico_data_horario_servico
 [X] 0010_chamadoassistencia
 [X] 0011_alter_chamadoassistencia_id_funcionario
 [X] 0012_alter_chamadoassistencia_titulo
 [X] 0013_alter_folgafuncionario_motivo_folga
 [X] 0014_alter_horarioservico_data_horario_servico
 [X] 0015_alter_horarioservico_data_horario_servico
 [X] 0016_alter_horarioservico_data_horario_servico
 [X] 0017_alter_horarioservico_unidade
 [ ] 0018_auto_20210809_1124
paginaInicial
 (no migrations)
sessions
 [X] 0001_initial
sites
 [X] 0001_initial
 [X] 0002_alter_domain_unique
socialaccount
 [X] 0001_initial
 [X] 0002_token_max_lengths
 [X] 0003_extra_data_default_dict
 [X] 0004_auto_20210712_1617

моя модель чиновника:

class Funcionario(AbstractUser):
    rg_funcionario = models.CharField(max_length=200)
    cpf_funcionario = models.CharField(unique = True, max_length=200)

    id_funcao_funcionario = models.ForeignKey(FuncaoFuncionario, on_delete=models.SET_NULL, null=True)

    telefone_funcionario = models.CharField(max_length=20)
    id_unidade = models.ForeignKey(Unidade, on_delete=models.SET_NULL, null=True, blank=True)

    rua = models.CharField(max_length=50)
    numero = models.CharField(max_length=10)
    bairro = models.CharField(max_length=50)
    cidade = models.CharField(max_length=50)
    estado = models.CharField(max_length=50)
    cep = models.CharField(max_length=10)

    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    def __str__(self):
        return str(self.first_name) + " " + str(self.last_name) + " (" + str(self.cpf_funcionario) + ")"

Я сделал миграцию, и когда я перешел к makemigration, это произошло

Вернуться на верх