I want to insert array of id's to a filed but while creating table i used int and it has the reference of another table now how can i store array value to the specific field?
db.query('CREATE TABLE IF NOT EXISTS departments_users(_id SERIAL NOT NULL UNIQUE PRIMARY KEY,user_id int REFERENCES companyUser ON DELETE CASCADE,department_id int REFERENCES departments ON DELETE CASCADE)');
exports.addCompanyUser = function(data, callback) {
db.query('INSERT INTO departments_users(user_id,department_id) VALUES($1,$2) RETURNING *', [companyuseraccess.rows[0]._id, data.department]).then(function(departments_users) {
})
}
via schedular
No comments:
Post a Comment