Open guilhermeKodama opened 8 years ago
I am facing the same problem with Mysql. Anyone have any solution please?
I had the same issue with MySQL -> save.
Insert starts working only if you declare a primary key on a Schema Model. For example:
// (not working) inserting new item creates an "id" column in a field list and fails
var KonGroup = schema.define('kon_group', {
kgr_id: { type: schema.Number, limit: 10 },
del_date: { type: schema.Date }
},{ });
// (working) inserting increases auto increment value of kgr_id and succeeds
var KonGroup = schema.define('kon_group', {
kgr_id: { type: schema.Number, limit: 10 },
del_date: { type: schema.Date }
},{
primaryKeys: ['kgr_id']
});
I've got the same problem with firebird. But i cannot undergo this by defining primary keys.
PlanungsPosition = schema.define('TPLANUNG_POS', {
TAG: { type: schema.Number },
MONAT: { type: schema.Number },
JAHR: { type: schema.Number },
MANR: { type: schema.Number},
KOMMISSIONSNR: { type: schema.String },
AUFTRAG: { type: schema.String },
SFK: { type: schema.String },
BEAUFTRAGT: { type: schema.Number }
},{
primaryKeys: ['TAG', 'MONAT', 'JAHR', 'MANR', 'KOMMISSIONSNR', 'AUFTRAG']
});
What could be the problem there? When i try to call
PlanungsPosition.create( ... )
i get following error:
Error: Dynamic SQL Error, SQL error code = -206, Column unknown, id, At line 1, column 128
In postgresql i seemed to be forced to create an id column in my table, setting the primaryKeys is not functioning. If i comment the this line on /adapters/postgres.js //sql += ' RETURNING id'; it seems to work , but for delete and others actions this problems repeats.