Skip to content

Commit

Permalink
breaking: do not pass db instance, destroy db instance at your own
Browse files Browse the repository at this point in the history
  • Loading branch information
acro5piano committed Jun 23, 2024
1 parent 1869c7e commit 4bd7673
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const migrator = new Migrator({
}),
})

run(db, migrator, migrationFolder)
run(migrator, migrationFolder).then(db.destroy)
```

Note: The above script assumes your migration folder is located at the same directory of chdir and named `./migrations`
Expand Down Expand Up @@ -110,7 +110,7 @@ export async function down(db: Kysely<any>): Promise<void> {
}
```

If you want to modify the default template, you can pass an option `--template=yourtemplate.txt` pointing to a file containing the custom template
If you want to modify the default template, you can pass an option `--template=yourtemplate.txt` pointing to a file containing the custom template.

If you want to change the path where migration files are stored, please modify the CLI code as follows:

Expand All @@ -119,7 +119,7 @@ If you want to change the path where migration files are stored, please modify t

// ...

run(db, migrator, 'dir/to/migration/files')
run(migrator, 'dir/to/migration/files').then(db.destroy)
```

# Experimental: CLI without a script file
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ const migrator = new Migrator({
})

export function main() {
run(db, migrator)
run(migrator).finally(db.destroy)
}

0 comments on commit 4bd7673

Please sign in to comment.