外键约束问题:django.db.utils.IntegrityError: (1215, ‘Cannot add foreign key constraint’)报错

外键约束问题:django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')报错
[外键约束问题]django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')

DATABASES= {

    'default': {

        'ENGINE': 'django.db.backends.mysql',

        'NAME': 'ebusiness',

        'USER':'root',

        'PASSWORD':'123456',

        'HOST':'localhost',

        'PORT':'3306',
        # 加下面这个
        'OPTIONS': {

            "init_command": "SET foreign_key_checks = 0;",

        }  # 加入这个在setting.py文件中数据库配置信息中
    }
}

Original: https://www.cnblogs.com/zonghan/p/16220826.html
Author: zong涵
Title: 外键约束问题:django.db.utils.IntegrityError: (1215, ‘Cannot add foreign key constraint’)报错

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/612999/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球