You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+40
Original file line number
Diff line number
Diff line change
@@ -208,6 +208,46 @@ With any of these, if `driver` is a string then it will be passed through `requi
208
208
>**Important:** All drivers must adhere to the [`Driver`interface](/ley.d.ts#L45-L67)!
209
209
210
210
211
+
## Typed Migrations
212
+
213
+
For extra confidence while writing your migration file(s), there are two options:
214
+
215
+
### TypeScript
216
+
217
+
1. Ensure [`ts-node`](https://www.npmjs.com/package/ts-node) is installed
218
+
219
+
2. Define a `ts-node` configuration block inside your `tsconfig.json` file:
220
+
221
+
```json
222
+
{
223
+
"ts-node": {
224
+
"transpileOnly": true,
225
+
"compilerOptions": {
226
+
"module": "commonjs"
227
+
}
228
+
}
229
+
}
230
+
```
231
+
232
+
3. Run `ley`with the [`require`](#optsrequire) option so that `ts-node` can processfile(s)
233
+
234
+
```sh
235
+
$ ley -r ts-node/register <cmd>
236
+
# or
237
+
$ ley --require ts-node/register <cmd>
238
+
```
239
+
240
+
### JSDoc
241
+
242
+
You may also use [JSDoc](https://jsdoc.app/) annotations throughout your file to achieve (most) of the benefits of TypeScript, but without installing and configuring TypeScript.
243
+
244
+
```js
245
+
/** @param {import('pg').Client} DB */
246
+
exports.up = async function (DB) {
247
+
await DB.query(...)
248
+
}
249
+
```
250
+
211
251
## API
212
252
213
253
>**Important:** See [Options](#options) for common options shared all commands. <br>In this`API` section, you will only find **command-specific** options listed.
0 commit comments