Skip to content

Creating relations result the foreign key to be changed/modified to a negative value #91

@sam2x

Description

@sam2x

Hi,

I find out your project who looks promising. So thanks you for providing us this ORM.
I stuck on a weirdz bug since 4hours, it's about relation.

Context

I have 3 models, let's name them ModelA, ModelB, ModelC. In my code i use the following relation scheme in pseudo code:

modelA = Factory('ModelA')
modelA.link(modelB)
modelC.link(modelA)
modelC.save()
modelA.save()

modelA is a new created Model, modelB & modelC has already been created, so in this context modelB & modelC are loaded(using findandload for modelB, using load for modelC).

Log

I used Redis monitor to log information. For this issue, i used simple model name. So here,
ModelA is Shop, ModelB is Location, and ModelC is User:

1423885279.079308 [1 127.0.0.1:49409] "get" "sess:IXRhx2QRV6sevTz7LC-e6TbLQTn25ICg"
1423885279.080167 [0 127.0.0.1:49405] "hgetall" "nohm:\hash:User:1"
1423885279.082581 [0 127.0.0.1:49405] "sinter" "nohm:index:Location:country:FRA"
1423885279.082952 [0 127.0.0.1:49405] "hgetall" "nohm:\hash:Location:1"
1423885279.083699 [0 127.0.0.1:49405] "sismember" "nohm:idsets:User" "1"
1423885279.083852 [0 127.0.0.1:49405] "sismember" "nohm:idsets:Shop" "-1423884760366"
1423885279.084342 [0 127.0.0.1:49405] "MULTI"
1423885279.084389 [0 127.0.0.1:49405] "EXEC"
1423885279.084709 [0 127.0.0.1:49405] "incr" "nohm:ids:Shop"
1423885279.084914 [0 127.0.0.1:49405] "MULTI"

Note: i put an \ before the "hash" string on the two hgetall commands cause emoji-smiley were displaying and i don't know how to disable this shit from github...

Assumption

Not sure what's happenings, but Nohm seems to set my Shop ID to -1423884760366 which looks like a timestamp, but i never touched/assigned the id value of Model...

I'm totally lost. May Nohm set this value by error during these two relations ?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions