sworm
sworm copied to clipboard
How can I get table name from model ?
How can I get table name from model ?
const programName = db.model({ table: 'PROGRAM_NAME' });
console.log( programName.model.table );
???
Database Oracle
Hi @adrianowy
There's (currently) no way to get at the table name from the model, but there is from an instance of the model. For e.g.
const programName = db.model({ table: 'PROGRAM_NAME' });
const stuff = programName({name: 'stuff'})
console.log(stuff._meta.table) // PROGRAM_NAME