db-migrate / db-migrate-base

Base driver for db-migrate
Other
7 stars 16 forks source link

Suggestion to improve .insert method signature #11

Closed nikarh closed 7 years ago

nikarh commented 7 years ago

Right now .insert method has the following signature:

insert(tableName, columnNameArray, valueArray, callback)

Unlike with SQL, it feels awkward to separate column names and values in JS. I would like to suggest changing this method signature or adding a new one with signature

insert(tableName, rowObject, callback)

where rowObject is simply an object where keys represent column names and values are values for the according column, for example:

await insert('test_table', {
  id: 1,
  name: 'test',
  'strange column name': true
})
nikarh commented 7 years ago

Didn't notice that there was a new piece of functionality (seeders) deprecating this method. I'll close this one