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

Add tests for cross-database relationships #44

Open
kmalakoff opened this issue Aug 14, 2014 · 1 comment
Open

Add tests for cross-database relationships #44

kmalakoff opened this issue Aug 14, 2014 · 1 comment

Comments

@kmalakoff
Copy link
Member

Ensure join table locations are deterministic

@forivall
Copy link
Contributor

Regarding the location of the join table, i would favour an approach that there is some kind of defined preference based on backends, (e.g. prefer creating the join table on sql instead of mongo; memory > sql > mongo) and if the tables use the same backend but different databases on that backend, either use an arbitrary but deterministic preference (like alphabetical order), or throw an error.
In either case, the join table location should be able to be manually defined like so

class Foo extends Backbone.Model
  schema:
    bars: -> ['hasMany', Bar, join_on_this_database: true]  # choose a better key name
  sync: FooSync('foo')

class Bar extends Backbone.Model
  schema:
    foos: -> ['hasMany', Foo]
  sync: BarSync('bar')

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

2 participants