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

Return object of changes as the result of 'sync' method execution #79

Closed
multum opened this issue Nov 28, 2019 · 1 comment · Fixed by #85 or #90
Closed

Return object of changes as the result of 'sync' method execution #79

multum opened this issue Nov 28, 2019 · 1 comment · Fixed by #85 or #90
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@multum
Copy link
Owner

multum commented Nov 28, 2019

const differ = new Differ({ ... });

differ.import(...)

const changes = differ.sync({ execute: true })
/**
[
  alter table "public"."users" add primary key ("id");
  ...
]
*/

const tableChanges = changes.filter((query) => {
  return /"public"."users"/.test(query)
})

const hasBeenChanged = tableChanges.length !== 0

const primaryKeyHasBeenAdded = Boolean(tableChanges.find((query) => {
  return /add primary key/i.test(query)
}))
@multum multum added the enhancement New feature or request label Nov 28, 2019
@multum multum added this to the v3.0 milestone Nov 28, 2019
@multum multum self-assigned this Nov 28, 2019
@multum multum mentioned this issue Nov 28, 2019
@PauleHan
Copy link

You're done some amazing work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants