Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lb4 specifying table name #2145

Closed
rexliu0715 opened this issue Nov 29, 2018 · 3 comments
Closed

lb4 specifying table name #2145

rexliu0715 opened this issue Nov 29, 2018 · 3 comments
Assignees

Comments

@rexliu0715
Copy link

my existing database table name "foo_bar". I generate a model "fooBar".

500 error: relation "schema.foobar" does not exist

where I can define the tablename? I does see reference on doc in lb4. please help. thanks

@dhmlau
Copy link
Member

dhmlau commented Dec 6, 2018

@rexliu0715 , you can add the settings in the model decorator.
In the example below, my model name is Customer2 but the table name is customer in my postgresql datasource.

@model({
  settings: {
    postgresql: {
      table: 'customer',
    },
  },
})
export class Customer2 extends Entity {

Hope it helps. If that's the case, do you mind submitting a PR to improve our docs? Thanks!

@dhmlau dhmlau self-assigned this Dec 6, 2018
@bajtos bajtos transferred this issue from strongloop/loopback Dec 11, 2018
@bajtos
Copy link
Member

bajtos commented Dec 11, 2018

See also #2134.

@bajtos
Copy link
Member

bajtos commented Dec 11, 2018

Closing as a duplicate of #2134.

@bajtos bajtos closed this as completed Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants