loopbackio / loopback-datasource-juggler

Connect Loopback to various Data Sources
http://www.loopback.io
Other
277 stars 364 forks source link

automigration of *-change models doesn't work #933

Closed kaktus42 closed 7 years ago

kaktus42 commented 8 years ago

Change models from here: https://docs.strongloop.com/display/public/LB/Synchronization#Synchronization-Setup

with definition of "trackChanges": true and no extra entry in model-config.json auto migration in boot script fails

module.exports = function(app) {
  var ds = app.datasources.myPostgres;
  var Todo = app.models.Todo;
  var TodoChange = app.models.Todo.Change;

  ds.automigrate(["Todo", "Todo-change"], function(err) {
    console.log(err);
  });
}

no error from this callback, but the table todo-change is not created. => error later on error: relation "public.todo-change" does not exist

kaktus42 commented 8 years ago

it seems that the Change Model subscribed an event when SQL query is executed. But in that listener it seems to call SQLConnector.all.

This leads to a all query when (even before) the table gets deleted with automigrate().

Can someone with more insight here, please help me out?

kaktus42 commented 8 years ago

Found this: strongloop/loopback-connector-postgresql#82 Also no solution so far... The workaround doesn't work for me

Amir-61 commented 8 years ago

Is this just an issue with Postgres or all SQL connectors? Could you please provide a sample repo reproducing the issue; you can use our loopback-sandbox to reproduce the issue.

Thanks

kaktus42 commented 8 years ago

kaktus42/loopback-sandbox

stale[bot] commented 7 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 7 years ago

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.