Skip to content

Question: How do you implement this via CLI? #5

Description

@sundeepgupta

I thought I should be implementing this using the CLI so that it could be part of a deploy sequence, something like:

Note: I've aliased loopback-component-migrate binary command to lcm

  1. npm install
  2. lcm up
  3. node server.js

I created a migration via lcm create initial which created the migration file in ./migrations/20160810101725-initial.js. The migration file looks like:

module.exports = {
  up: function(dataSource, next) {
    console.log('running initial up');
    next();
  },
  down: function(dataSource, next) {
    console.log('running initial down');
    next();
  }
};

When I run lcm up, first thing output is "Migrating up to: "20160810101725-initial.js" [TODO]" and then I see output from starting the app up, just like I'd see if I ran node server.js. I don't see the logs I inserted into the migration or anything. The app continues to listen for web requests/socket messages...

I'm using MongoDB as my data store and when I look inside, I don't see a collection for Migrations or anything.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions