SqlScriptMigrationTask
A migration task that runs a raw SQL script against the target database — the resolved form of a
*.task.sql file, or an inline object with the same shape.
| Property | Type | Required | Description |
|---|---|---|---|
script | string | Function | yes | The SQL script to execute, or a function that produces it. |
title | string | no | Human-readable title, shown in task-start/task-finish events. Defaults to "Run sql script" when loaded from a *.task.sql file. |
filename | string | no | Source file this task was loaded from, if any — set automatically by folder discovery. |
import type { SqlScriptMigrationTask } from '@sqb/migrator';
const task: SqlScriptMigrationTask = {
title: 'Create customers table',
script: 'CREATE TABLE customers (id serial primary key, name text not null);',
};
On disk, the same task is a *.task.sql file containing just the raw SQL — see
Writing Migration Tasks.