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

wip: v1 #26

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ jobs:
path: node_modules
- run: pnpm install
- run: pnpm tsc
- run: pnpm test
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22
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
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
db:
image: postgres:16.3-alpine
ports:
- '45432:5432'
environment:
POSTGRES_PASSWORD: postgres
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"README.md"
],
"scripts": {
"test": "node -r esbuild-register --test 'tests/*.test.ts'",
"prepublish": "tsc",
"build": "tsc",
"r": "tsc && node dist/index.js"
Expand All @@ -29,6 +30,9 @@
"devDependencies": {
"@types/node": "^20.14.8",
"@types/pg": "^8.11.6",
"esbuild": "^0.21.5",
"esbuild-register": "^3.5.0",
"execa": "^9.3.0",
"kysely": "^0.24.2",
"pg": "^8.12.0",
"typescript": "^5.5.2"
Expand Down
Loading
Loading