JBRandri
JBRandri

Reputation: 315

How to use auto migration with loopback 4 for mysql datasource

Please , help There is nothing about auto migration in loopback4 with a mysql datasource

Upvotes: 0

Views: 260

Answers (1)

Sachin S
Sachin S

Reputation: 196

let auth = server.dataSources.auth;
auth.isActual( function(err, actual) {
    if (!actual) {
      auth.autoupdate(function(err, result) {
        console.log('Error in autoMigrate script',err);
        console.log("All tables are updated..");
      });
    }
  });

I hope this clarifies your query;
And auth is a datasource defined in datasource.json

Upvotes: 1

Related Questions