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

Any Possible way to migrate on db user version base ? #21

Open
HimeshAsite512 opened this issue Jul 19, 2022 · 1 comment
Open

Any Possible way to migrate on db user version base ? #21

HimeshAsite512 opened this issue Jul 19, 2022 · 1 comment

Comments

@HimeshAsite512
Copy link

Any Possible way to migrate on db user version base ?

There is a scenario db file have few columns available in data structure and when migration file executes again it throughs error and the query which is written below that line will not getting executed.

can any one help out in it ?

@beenotung
Copy link
Contributor

My workaround to avoid the migration to be ran partially is to run it inside transaction.

For example:

db.transaction(()=>{
  // run the migration here
})()

A working example: https://github.com/beenotung/better-sqlite3-schema/blob/f30b6ffe5140380005fbeca764cc1697db55fb3c/src/migrate.ts#L45

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