sworm icon indicating copy to clipboard operation
sworm copied to clipboard

How can I get table name from model ?

Open adrianowy opened this issue 5 years ago • 1 comments

How can I get table name from model ?

const programName = db.model({ table: 'PROGRAM_NAME' });


console.log( programName.model.table );

???

Database Oracle

adrianowy avatar Apr 25 '19 18:04 adrianowy

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

refractalize avatar Apr 25 '19 20:04 refractalize