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

migrator: run "wipe" without confirmation #436

Open
indeyets opened this issue Dec 4, 2024 · 2 comments
Open

migrator: run "wipe" without confirmation #436

indeyets opened this issue Dec 4, 2024 · 2 comments

Comments

@indeyets
Copy link

indeyets commented Dec 4, 2024

It could be useful to run migrate wipe in automated scenarios before running tests.
Currently, it seems to be pretty insistent on requesting confirmation.

could be some flag like --i-know-what-i-am-doing maybe?
or just --yes :)

@mmkal
Copy link
Owner

mmkal commented Dec 5, 2024

You can do this now by passing a custom confirm function into the API, but yeah, to avoid people needing to wrap the CLI and worry about how it's implemented, I like this idea.

@indeyets
Copy link
Author

This is roughly how I solved it. I'll leave it for someone to find:

import { Migrator as Base } from "@pgkit/migrator";

const yes: Confirm = (sql: string) => {
  return sql;
};

class Migrator extends Base {
  wipe(): Promise<void> {
    return super.wipe({ confirm: yes });
  }
}

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