doubleleft / hook

A RESTful and extendable Backend as a Service that provides instant backend to develop sites and apps faster, with dead-simple integration for JavaScript, iOS, Android and more.

Home Page:http://hook-platform.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

auto-migrate on update_multiple operations

endel opened this issue · comments

Demonstration inconsistent API:

client: javascript> hook.collection("items").create({name: "Hey there"})
{ name: 'Hey there',
  updated_at: Thu Apr 02 2015 15:22:15 GMT-0300 (BRT),
  created_at: Thu Apr 02 2015 15:22:15 GMT-0300 (BRT),
  _id: 1 }

client: javascript> hook.collection("items").update(1, {new_field: "1"})
{ _id: '1',
  created_at: Thu Apr 02 2015 15:22:15 GMT-0300 (BRT),
  updated_at: Thu Apr 02 2015 15:22:27 GMT-0300 (BRT),
  name: 'Hey there',
  new_field: '1' }

client: javascript> hook.collection("items").updateAll({new_field_2: "2"})
{ error: 'no such column: new_field_2', code: 500 }

When calling updateAll the new_field_2 field should be created, as it occurs in update call.