This is my table(CELLID) structure.
+---------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+------------+------+-----+---------+-------+
| CELL_ID | int(11) | NO | PRI | NULL | |
| STATUS | tinyint(4) | NO | | NULL | |
+---------+------------+------+-----+---------+-------+
And this is my code to insert into the table.
knex('CELLID').insert(insertObj)
.then(function (result) {
_log.info(reqContainer.uuid, "Successfully Added To CELLID||", result)
// respond back to request
_log.info(reqContainer.uuid, "Exiting CELLID_S");
return resolve(result) // respond back to request
})
.catch(function (err) {
_log.error(reqContainer.uuid, "Failed Adding To CELLID ||", err)
_log.error(reqContainer.uuid, "Exiting CELLID_S");
// respond back to request
return reject(Error("Failed Adding CELLID"));
})
After a successful insert, the Id has to be returned.This does not happen in my case. I always get and Id of 0 on an insert.
I had tried by adding an extra column, auto-increment primary key ID(removing CELL_ID as PK).In this case, I get the ID(auto-increment value).
What am I missing here?
Thanks.