-
Notifications
You must be signed in to change notification settings - Fork 209
Database Seeds
Boris Mann edited this page Feb 13, 2016
·
2 revisions
From nodal 0.6 release:
You can now modify config/seed.json
to set environment (NODE_ENV
) specific seeds. Each environment configuration takes an Object of model names, which each expects an array of objects representing values to insert.
Any beforeSave()
logic will be triggered for each Model.
Seeds can executed using nodal db:seed
.
For example,
{
"test": {
"User": [
{
"email": "[email protected]",
"password": "password",
"username": "test"
}
],
"Post": [
{
"body": "Hello, world."
},
{
"body": "Post #2"
}
]
}
}
If you get Error: Could not seed, no seed found in "./config/seed.json"
, it is likely the seed.json
file is not well-formed JSON (looking for missing / additional commas, etc.).