Closed xualen closed 5 years ago
Hi @xualen
thanks!
openrecord always pluralize model names to get the table name. In your case, you need to tell openrecord not to do so:
const store = new Store({
// your config here...
inflection: {
'admins' : 'admin'
}
})
@PhilWaldmann thanks. but i have a another question. is there transaction in openrecord?
@PhilWaldmann thank u. is openrecord support lock tables?
not out of the box.
but it should be possible via:
await store.startTransaction(trx => {
store.connection.transacting(trx).raw('LOCK TABLE...')
.then(() => {
...
})
})
The above code is not tested!!
store.connection
returns a knex instance.
transacting
and raw
are knex functions!
let me know if that works for you.
Thanks, Philipp
@PhilWaldmann thanks for your answer.
Thanks for a great library. there is a table(admin) in mysql, i use "store.Model('admin');". node js log error "Error: ER_NO_SUCH_TABLE: Table 'test.admins' doesn't exist"