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.

model.schema(....) not setting model.$schema

See original GitHub issue

What you are doing?

let myModel = sequelize.define('foo', {...});
myModel.schema('test');
myModel.find({...});

What do you expect to happen?

I want generated SQL statements to prefix the correct schema (“test”) to the model’s table name. e.g. select ... from "test"."foo"...

What is actually happening?

The schema provided is not found in the generated SQL. This used to work in a previously used version… Updating my code to call myModel.$schema = 'test'; makes this work as expected. But the documentation should reflect that and/or the .schema() should be fixed/removed

Dialect: postgres Database version: 9.4 Sequelize version: 4.0.0-0

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
felixfbeckercommented, Jul 26, 2016

Is there a reason why it clones the model class? It may have unintended side effects with the inheritance in v4

0reactions
felixfbeckercommented, Jul 27, 2016

@mickhansen maybe this could be solved better by a Model.clone() method

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Mongoose model schema referencing not working
I've the used populate method in mongoose to populate the referenced property in the model.But it is not working and I'm getting an...
Read more >
Mongoose v6.8.2: Schemas
Schemas not only define the structure of your document and casting of properties, they also define document instance methods, static Model methods, ...
Read more >
Custom schemas - dbt Developer Hub
If a custom schema is provided, a model's schema name should match the custom schema, rather than being concatenated to the target schema....
Read more >
Schema - pydantic
Pydantic allows auto creation of JSON Schemas from models: ... exclusiveMaximum will not be enforce) class Model(BaseModel): foo: PositiveInt = Field(..., ...
Read more >
Entity Framework Core Model Configuration
It is not possible to specify the default schema using Data Annotations attributes. Exclude a Type. The Ignore<TEntity>() method enables you to explicitly ......
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