Closed connor11528 closed 8 years ago
@connor11528 Actually yes you have to configure store. There is a section about configuration here: https://github.com/trailsjs/trailpack-mongoose#configure-stores
There is option: migrate
. You have to set it up to create
or drop
.
You might have alter
or not set up at all.
Okay cool I see that. Where in my application do I put the code in the "Configure stores" section? Do I configure stores in config/env/production.js? What file stores the Stores configuration.. if that makes sense!
Okay my bad. All that needs to happen is edit the stores file in config/database.js. n00b mistake
Default file will look like this:
/**
* Database Configuration
* (app.config.database)
*
* Configure the ORM layer, connections, etc.
*
* @see {@link http://trailsjs.io/doc/config/database}
*/
'use strict'
module.exports = {
/**
* Define the database stores. A store is typically a single database.
*
* Use the SQLite3 by default for development purposes.
*
* Set production connection info in config/env/production.js
*/
stores: {
/**
* Define a store called "local" which uses SQLite3 to persist data.
*
* To use this store, uncomment the "sqlitedev" store section below, and
* run "npm install --save waterline-sqlite3"
*/
/*
dev: {
adapter: require('waterline-sqlite3'),
migrate: 'alter'
}
*/
},
models: {
defaultStore: 'dev',
migrate: 'alter'
}
}
Yep exactly. it should be into config/database.js
or in database
section into config/env/{env}.js
file. I'll update description in a moment
Thank you!
This is pretty basic but I would appreciate the help! I create a new application using express 4 and mongoose with trails.js. I got the following error (see below).
I see that I probably need to configure Stores. Where do I do that? I see it in the README but it is not clear to me where the code must go.
I appreciate any direction or help. Happy to submit a PR to clear things up if there is an obvious answer. thank you.