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

Feature: Shared model definitions #63

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

Damienmarble
Copy link
Contributor

@Damienmarble Damienmarble commented Feb 15, 2019

Description, Motivation and Context

Adds support for sharing model definitions between multiple sequelize datasources automatically.

What is the current behavior?

Models can only be created for a single datasource at a time.

What is the new behavior?

When multiple datasources are configured and the config/sequelize.js property shareModelsAmongConnections is true, any models where the connection property is not explicitly set will be added to all sequelize connections.

Additionally, if sails models are configured to expose models globally, the shared models can be access through the global model class through a property with the same name as the associated datasource. e.g. Model[datasourceName].someMethod()

What kind of change does this PR introduce?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • Overall test coverage is not decreased.
  • All new and existing tests passed.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@KSDaemon
Copy link
Owner

Seems that this work is not finished yet...

@Damienmarble
Copy link
Contributor Author

I'm looking at why the tests succeed locally but fail in travis.

@coveralls
Copy link

Coverage Status

Coverage decreased (-19.2%) to 71.138% when pulling 2da50be on ThisIsNoZaku:feature/shared_model_definitions into fd61411 on KSDaemon:master.

@KSDaemon
Copy link
Owner

I've refactored tests heavily. So, please, pull updates from master into your code

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

Successfully merging this pull request may close these issues.

None yet

4 participants