2013-04-30 2 views
0

Il apparaît que lorsque j'utilise la fonction addSomething pour créer une association supplémentaire, Sequelize met à jour chaque association existante en marquant le champ d'id associé NULL, puis REupdate chacun d'entre eux AVEC l'identifiant associé. Pourquoi dans le monde feraient-ils cela et plus important encore, comment puis-je l'arrêter?Sequelize semble mettre à jour tous les enregistrements associés sur ajouter?

number.addCall(call).success(function(call){ 
    console.log("addCall"); 
}); 

Et la sortie console:

Executing: UPDATE "Calls" SET "from"='+16159572942',"to"='+16159002621',"callsid"='CAe843623d58ae3453910ce0a8e6ae065b',"direction"='inbound',"callstatus"='completed',"fromcity"='NASHVILLE',"fromstate"='TN',"fromzip"='37115',"fromcountry"='US',"callduration"='6',"id"=24,"createdAt"='2013-04-24 18:12:44.695000',"updatedAt"='2013-04-30 19:19:38.392000',"deletedAt"=NULL,"PhonenumberId"=NULL WHERE "id"=24 RETURNING * 
Executing: UPDATE "Calls" SET "from"='+16159572942',"to"='+16159002621',"callsid"='CA8045f80aee98e334d57deb3a31140f7f',"direction"='inbound',"callstatus"='completed',"fromcity"='NASHVILLE',"fromstate"='TN',"fromzip"='37115',"fromcountry"='US',"callduration"='5',"id"=25,"createdAt"='2013-04-25 17:35:46.919000',"updatedAt"='2013-04-30 19:19:38.393000',"deletedAt"=NULL,"PhonenumberId"=NULL WHERE "id"=25 RETURNING * 
Executing: UPDATE "Calls" SET "from"='+16159572942',"to"='+16159002621',"callsid"='CAd0c476c2f790944cd4962651a86ee299',"direction"='inbound',"callstatus"='completed',"fromcity"='NASHVILLE',"fromstate"='TN',"fromzip"='37115',"fromcountry"='US',"callduration"='6',"id"=26,"createdAt"='2013-04-30 18:42:01.838000',"updatedAt"='2013-04-30 19:19:38.393000',"deletedAt"=NULL,"PhonenumberId"=NULL WHERE "id"=26 RETURNING * 
Executing: UPDATE "Calls" SET "from"='+16159572942',"to"='+16159002621',"callsid"='CAe843623d58ae3453910ce0a8e6ae065b',"direction"='inbound',"callstatus"='completed',"fromcity"='NASHVILLE',"fromstate"='TN',"fromzip"='37115',"fromcountry"='US',"callduration"='6',"id"=24,"createdAt"='2013-04-24 18:12:44.695000',"updatedAt"='2013-04-30 19:19:38.394000',"deletedAt"=NULL,"PhonenumberId"=1 WHERE "id"=24 RETURNING * 
Executing: UPDATE "Calls" SET "from"='+16159572942',"to"='+16159002621',"callsid"='CA8045f80aee98e334d57deb3a31140f7f',"direction"='inbound',"callstatus"='completed',"fromcity"='NASHVILLE',"fromstate"='TN',"fromzip"='37115',"fromcountry"='US',"callduration"='5',"id"=25,"createdAt"='2013-04-25 17:35:46.919000',"updatedAt"='2013-04-30 19:19:38.395000',"deletedAt"=NULL,"PhonenumberId"=1 WHERE "id"=25 RETURNING * 
Executing: UPDATE "Calls" SET "from"='+16159572942',"to"='+16159002621',"callsid"='CAd0c476c2f790944cd4962651a86ee299',"direction"='inbound',"callstatus"='completed',"fromcity"='NASHVILLE',"fromstate"='TN',"fromzip"='37115',"fromcountry"='US',"callduration"='6',"id"=26,"createdAt"='2013-04-30 18:42:01.838000',"updatedAt"='2013-04-30 19:19:38.395000',"deletedAt"=NULL,"PhonenumberId"=1 WHERE "id"=26 RETURNING * 
Executing: UPDATE "Calls" SET "from"='+16159572942',"to"='+16159002621',"callsid"='CAca700726a04726c976baeec0b3b11714',"direction"='inbound',"callstatus"='ringing',"fromcity"='NASHVILLE',"fromstate"='TN',"fromzip"='37115',"fromcountry"='US',"callduration"=NULL,"id"=27,"createdAt"='2013-04-30 19:19:38.328000',"updatedAt"='2013-04-30 19:19:38.396000',"deletedAt"=NULL,"PhonenumberId"=1 WHERE "id"=27 RETURNING * 
addCall 

Tout ce qu'il doit faire est de mettre à jour un enregistrement, celui que la variable "appel" représente. Cela finira par écraser la base de données dès qu'il y aura des milliers ou plus d'appels associés à un nombre.

Répondre

0

Il s'avère qu'il s'agit d'un problème dans les versions antérieures à la version 1.6.0, y compris les bêtas. La mise à jour vers la version 1.6.0 a fait que ce comportement se comporte comme prévu.

Questions connexes