Skip to content

Commit 35cd92a

Browse files
authored
Store and verify checksums of migration files (#16)
1 parent 7c558df commit 35cd92a

File tree

19 files changed

+3092
-106
lines changed

19 files changed

+3092
-106
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
"overrides": [
88
],
99
"parserOptions": {
10-
"project": "./tsconfig.json",
10+
"project": [ "./tsconfig.json", "./test/tsconfig.json"],
1111
"ecmaVersion": "latest",
1212
"sourceType": "module"
1313
},
1414
"rules": {
15+
"@typescript-eslint/no-misused-promises": "off"
1516
},
1617
"ignorePatterns": ["dist/**/*"]
1718
}

.github/workflows/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ jobs:
1515
run: npm run build
1616
- name: Lint
1717
run: npm run lint
18+
- name: Test
19+
run: npm run test

README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
## Podil [![Build](https://github.com/podiljs/podil/actions/workflows/build.yaml/badge.svg)](https://github.com/podiljs/podil/actions/workflows/build.yaml) [![npm version](https://img.shields.io/npm/v/podil.svg?style=flat)](https://www.npmjs.com/package/podil) [![install size](https://packagephobia.com/badge?p=podil)](https://packagephobia.com/result?p=podil)
1+
## Podil [![Build](https://github.com/podiljs/podil/actions/workflows/build.yaml/badge.svg)](https://github.com/podiljs/podil/actions/workflows/build.yaml) [![npm version](https://img.shields.io/npm/v/podil.svg?style=flat)](https://www.npmjs.com/package/podil) [![install size](https://packagephobia.com/badge?p=podil)](https://www.npmjs.com/package/podil)
22

3-
<img src="https://raw.githubusercontent.com/podiljs/podil/main/.github/logo.svg" align="right" width="125px" alt="Podil logo">
3+
Lightweight and secure database migration tool for Node.js and Postgres. Podil lets
4+
you version your database by executing SQL scripts automatically on application
5+
startup. It keeps track of what scripts have been executed and what not which lets
6+
you seamlessly update your database schema on every environment in the same way. Podil
7+
saves you from mistakingly breaking your schema by storing and verifying checksums
8+
of every script that it executed. Podil strives at being simple and minimalistic,
9+
that's why it brings no dependencies except for Podil itself.
410

5-
Lightweight and secure database migration tool for Node.js and Postgres.
611

712
### How to use
813
Install Podil and pg:
@@ -37,14 +42,19 @@ in the lexicographical order.
3742
3843
### Configuration
3944
40-
By default, Podil looks for migrations in `./migrations`, you can pass a
41-
custom folder for migrations as a second argument to the `migrate()` call:
45+
Podil can be configured to look for migration scripts in an arbitrary location.
46+
By default, it looks for migrations in `./migrations`, you can pass a custom
47+
folder in the following way:
4248
4349
```shell
44-
await podil.migrate(
45-
'postgres://podil:podil@localhost:5432/podil',
46-
'/app/sql/migrations'
47-
);
50+
await podil.migrate(connectionString, { migrationsDir: '/path/to/your/migrations' });
51+
```
52+
53+
It is recommended to verify the checksums of your scripts on every run. However,
54+
you can disable checksum verification using the `verifyChecksum` property:
55+
56+
```shell
57+
await podil.migrate(connectionString, { verifyChecksum: false });
4858
```
4959
5060
### Troubleshooting

0 commit comments

Comments
 (0)