question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bookshelf.Model.extend deprecation

See original GitHub issue

Bookshelf.Model.extend deprecation

Introduction

What are our alternatives to Bookshelf.Model.extend?

Issue Description

I used to define my models this way:

const Lembrete = Bookshelf.Model.extend({
  tableName: "lembrete",
  idAttribute: "idlembrete"
});

However i noticed that approach got deprecated. The docs have no news regarding how should i define my models now.

This is the best i got for now:

class StatusDoacao extends Bookshelf.Model {
  get idAttribute() { return "idstatusdoacao"; }
  get tableName() { return "statusdoacao"; }
}

Any guidance on how to make it cleaner using es6 is very welcome.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sombrikscommented, Nov 15, 2017

@ricardogama the editor gave me this hint. but now i am not sure if it’s real.

captura de tela de 2017-11-15 15-47-43

0reactions
dustingrahamcommented, Jan 2, 2020

Same issue. Found the reason in my case.

Guess I’ll remove that type hint. Bookshelf does a pretty good job on its own.

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Reference - Bookshelf.js
Model. Models are simple objects representing individual database rows, specifying the tableName and any relations to other models. They can be extended with ......
Read more >
api documentation for bookshelf (v0.10.3)
Model = _model2.default.extend({ _builder: builderFn, // The `Model` constructor is referenced as a property on the `Bookshelf` // instance, mixing in the ...
Read more >
Node + Express + Bookshelf - Stack Overflow
I just include the files with the model in the controller, there is this node lib that basically let you include an entire...
Read more >
bookshelf-secure-password - NPM Package Overview - Socket
A Bookshelf.js plugin for handling secure passwords. ... Deprecated, Install scripts ... Model.extend({ tableName: 'users', hasSecurePassword: true }).
Read more >
bookshelf-0.10.3 - Yarn
Bookshelf is a JavaScript ORM for Node.js, built on the Knex SQL query builder. Featuring both promise based and traditional callback interfaces, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found