db-migrate / db-migrate-base

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

Insert improperly compares number of columns and value columns #27

Open balint-balku-scraperapi opened 3 years ago

balint-balku-scraperapi commented 3 years ago

Insert performs an improper check when multiple columns and multiple rows of data passed to the call.

Example:

insert('table_name',
  [ 'column1', 'column2' ],
  [ [ 'row1_col1', 'row1_col2' ], [ 'row2_col1', 'row2_col2' ], [ 'row3_col1', 'row3_col2' ] ]
);

The above should be ok as the number of columns matches the number of value-columns, but it does throw an error in the current implementation.