Module

x/kysely_postgrs_js_dialect/mod.ts>kysely.FileMigrationProvider

Kysely dialect for PostgreSQL using the Postgres.js client.
class kysely.FileMigrationProvider
implements MigrationProvider
import { kysely } from "https://dotland.deno.dev/x/kysely_postgrs_js_dialect@v0.27.3/mod.ts";
const { FileMigrationProvider } = kysely;

Reads all migrations from a folder in node.js.

Examples

import { promises as fs } from 'fs'
import path from 'path'

new FileMigrationProvider({
  fs,
  path,
  migrationFolder: 'path/to/migrations/folder'
})

Constructors

new
FileMigrationProvider(props: FileMigrationProviderProps)

Methods

getMigrations(): Promise<Record<string, Migration>>

Returns all migrations, old and new.

For example if you have your migrations in a folder as separate files, you can implement this method to return all migration in that folder as Migration objects.

Kysely already has a built-in FileMigrationProvider for node.js that does exactly that.

The keys of the returned object are migration names and values are the migrations. The order of the migrations is determined by the alphabetical order of the migration names. The items in the object don't need to be sorted, they are sorted by Kysely.