markusahlstrand / knex-data-api-client

Knex Aurora Data API Client
MIT License
22 stars 23 forks source link

when using `update.returning` types are not applied #101

Closed viqueen closed 2 years ago

viqueen commented 2 years ago

From what I see, column types are only applied on select method, but we expect them to work for update.returning too

await domain.schema.createTableIfNotExists('information', (t) => {
         t.bigIncrements('id');
         t.string('dynamo_id').unique().nullable();
         t.jsonb('payload');
});

const [output] = await domain('information')
        .update({
            id: 1,
            user_id: 'one',
            payload: { name: 'moi', age: 22 }
        })
        .returning('*');

    console.info('** payload', output.payload);
    console.info('** name', output.payload.name); // returns undefined
viqueen commented 2 years ago

fix on the way here https://github.com/markusahlstrand/knex-data-api-client/pull/100