Skip to main content
Module

x/cotton/mod.ts>MigrationRunner

SQL Database Toolkit for Deno
Latest
class MigrationRunner
import { MigrationRunner } from "https://deno.land/x/cotton@v0.7.5/mod.ts";

Run migration classes

Constructors

new
MigrationRunner(
migrationDir: string,
adapter: Adapter,
version: string,
)

Methods

private
getAllMigrationFiles(): Promise<MigrationInfo[]>

Get all migration classes

Execute a new batch of migrations

createMigrationFile(name: string): Promise<string>

Create a new migration script

Create the migrations table if it doesn't exist yet

ensureMigrationDir(): Promise<void>

Ensures that the migration directory exists. If the directory structure does not exist, it is created. Like mkdir -p. Requires the --allow-read and --allow-write flag.

getAllMigrations(): Promise<{ migrations: MigrationInfo[]; lastBatch: number; }>

Get all available migrations

revertMigrations(steps?: number)

Revert executed migrations from the last batch