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

Guids for replicated models #1140

Merged
merged 2 commits into from
Mar 2, 2015
Merged

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented Feb 26, 2015

  • Print a deprecation warning when a persisted model is tracking changes but does not have a client-generated unique string id property (GUID).
  • Fix all test models that are tracking changes so that they have a generated unique string id.
  • Make model names unique where possible to prevent tests reusing the same model which causes unintented side effects.

Closes #981

/to @ritch please review. I decided to use soft deprecation warning instead of throwing an exception. This way we are not breaking backwards compatibility and make the upgrade process easier (IMO).

deprecated('The model ' + this.modelName + ' is tracking changes, ' +
'which requries a string id with GUID/UUID default value.');
}

Change.attachTo(this.dataSource);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That regex is a bit silly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall I rewrite it as !(id.Prop.defaultFn === 'uuid' || id.Prop.defaultFn === 'guid')?

@bajtos
Copy link
Member Author

bajtos commented Feb 27, 2015

Ouch, depd does not work in the browser :( I'll need to fix juggler as well.

@bajtos
Copy link
Member Author

bajtos commented Feb 27, 2015

Fixed, the patch depends on loopbackio/loopback-datasource-juggler#473 now.

@ritch LGTY now?

@ritch
Copy link
Member

ritch commented Mar 2, 2015

LGTM

@bajtos bajtos force-pushed the feature/guids-for-replicated-models branch from 4f7d6b0 to f2c5af4 Compare March 2, 2015 16:01
@ritch ritch assigned bajtos and unassigned ritch Mar 2, 2015
Miroslav Bajtoš added 2 commits March 2, 2015 18:16
Print a deprecation warning when a persisted model is tracking changes
but does not have a client-generated unique string id property (GUID).
Fix all test models that are tracking changes so that they have
a generated unique string id.

Make model names unique where possible to prevent tests reusing
the same model which causes unintented side effects.
@bajtos bajtos force-pushed the feature/guids-for-replicated-models branch from f2c5af4 to f21b29e Compare March 2, 2015 17:16
bajtos added a commit that referenced this pull request Mar 2, 2015
@bajtos bajtos merged commit d24da8c into master Mar 2, 2015
@bajtos bajtos removed the #review label Mar 2, 2015
@bajtos bajtos deleted the feature/guids-for-replicated-models branch March 2, 2015 17:23
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.

Enforce guid for replication
2 participants