|
1 | | -## Podil [](https://github.com/podiljs/podil/actions/workflows/build.yaml) [](https://www.npmjs.com/package/podil) [](https://packagephobia.com/result?p=podil) |
| 1 | +## Podil [](https://github.com/podiljs/podil/actions/workflows/build.yaml) [](https://www.npmjs.com/package/podil) [](https://www.npmjs.com/package/podil) |
2 | 2 |
|
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. |
4 | 10 |
|
5 | | -Lightweight and secure database migration tool for Node.js and Postgres. |
6 | 11 |
|
7 | 12 | ### How to use |
8 | 13 | Install Podil and pg: |
@@ -37,14 +42,19 @@ in the lexicographical order. |
37 | 42 |
|
38 | 43 | ### Configuration |
39 | 44 |
|
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: |
42 | 48 |
|
43 | 49 | ```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 }); |
48 | 58 | ``` |
49 | 59 |
|
50 | 60 | ### Troubleshooting |
|
0 commit comments