错误:具有外键时,没有唯一的约束条件匹配给定表的键

时间:2018-12-16 17:37:31

标签: python-3.x postgresql django-models

我尝试迁移并得到没有唯一约束匹配的故障。

这些是我的模特

let rec partitionWhile p = function
| x::xs, y::ys when p x y -> partitionWhile p (y::x::xs, ys)
| xss, yss -> List.rev xss, yss

let rec splitList list = [
    if not <| List.isEmpty list then
        let acc, rest = partitionWhile (<=) ([list.Head], list.Tail)
        if not <| List.isEmpty acc then
            yield acc
        yield! splitList rest ]

splitList [1;2;3;3;4]
// val it : int list list = [[1; 2; 3; 3; 4]]
splitList [1;2;3;2;4;3;5]
// val it : int list list = [[1; 2; 3]; [2; 4]; [3; 5]]

故障消息是

  

django.db.utils.ProgrammingError:没有唯一约束   匹配参考表“ team_teamrole”的给定键

有趣的是,使用sqlite在我的开发设置上没问题。但是在我的带有postgres的生产服务器上,它在迁移时会抱怨。

我迷路了。

0 个答案:

没有答案