Skip to main content

InsertDataMigrationTask

A migration task that inserts a fixed set of rows into a table — the resolved form of a *.task.json file shaped as { tableName, rows }.

PropertyTypeRequiredDescription
tableNamestringyesTable to insert into.
rowsRecord<string, any>[]yesRows to insert.
titlestringnoHuman-readable title. Defaults to "Migrate data into <tableName>" when loaded from a *.task.json file.
filenamestringnoSource file this task was loaded from, if any.
import type { InsertDataMigrationTask } from '@sqb/migrator';

const task: InsertDataMigrationTask = {
tableName: 'countries',
rows: [
{ code: 'US', name: 'United States' },
{ code: 'DE', name: 'Germany' },
],
};

See Writing Migration Tasks for the on-disk *.task.json form.