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

Error: Migrate must be configured to either "create" or "drop" #12

Closed
connor11528 opened this issue Jul 11, 2016 · 5 comments
Closed

Error: Migrate must be configured to either "create" or "drop" #12

connor11528 opened this issue Jul 11, 2016 · 5 comments

Comments

@connor11528
Copy link
Contributor

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.

$ node server
error: 
 Error: Migrate must be configured to either "create" or "drop"
    at MongooseTrailpack.validate (/Users/connorleech/Projects/trails-tutorial/node_modules/trailpack-mongoose/index.js:19:13)
    at app.after.then (/Users/connorleech/Projects/trails-tutorial/node_modules/trails/lib/trailpack.js:68:26)
    at process._tickDomainCallback (internal/process/next_tick.js:129:7)
    at Function.Module.runMain (module.js:577:11)
    at startup (node.js:159:18)
    at node.js:444:3
error: The application did not boot successfully.
error: Try increasing the loglevel to "debug" to learn more
@konstantinzolotarev
Copy link
Collaborator

@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.

@connor11528
Copy link
Contributor Author

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!

@connor11528
Copy link
Contributor Author

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'
  }
}

@konstantinzolotarev
Copy link
Collaborator

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

@connor11528
Copy link
Contributor Author

Thank you!

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