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

Option to only load waterline-fixtures on first load #28

Closed
lynnaloo opened this issue Aug 31, 2015 · 4 comments
Closed

Option to only load waterline-fixtures on first load #28

lynnaloo opened this issue Aug 31, 2015 · 4 comments

Comments

@lynnaloo
Copy link

Right now, the fixtures seem to be loading every time the server starts, even if migrate: safe is set in the models. If there are no unique fields, then it duplicates the data. If there are unique fields, then the plugin fails on server startup. I'd like the option to just load the fixtures on a blank database only.

@devinivy
Copy link
Owner

Maybe this will get you by for now: if you specify a primary key in your fixture, the record with that id will be updated rather than created.

@devinivy
Copy link
Owner

devinivy commented Sep 4, 2015

@lynnaloo do you have a suggested spec? I like the idea you alluded to of respecting the migrate option per collection.

Also, I'd like to point out that there is a marginally related bug in waterline-fixtures: devinivy/waterline-fixtures#2

@lynnaloo
Copy link
Author

@devinivy I simplified my fixtures more and it looks like my issue is with the nested models. Even if I specify the primary key id, it tries to add them again to the join table and gets a constraint violation.

Edit: I can now get this to work if migrate is set to alter, but then it does not work to initially create the database.

@devinivy
Copy link
Owner

devinivy commented Jun 7, 2016

Sadly gotta drop this– the problems around fixtures/migrations are a hard enough to merit their own tools! Next version of dogwater wont have fixtures (#40).

@devinivy devinivy closed this as completed Jun 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants