Run Schema Migration
migrateApply tracked schema changes (DDL) like CREATE TABLE or ALTER TABLE to a database. Migrations are idempotent, so running the same name multiple times is safe.
Instructions
Apply a schema change (DDL) to a database. Migrations are tracked in _lobsterdb_migrations and are idempotent — safe to call multiple times with the same name.
Guidelines:
Use for all DDL: CREATE TABLE, ALTER TABLE ADD COLUMN, CREATE INDEX, etc.
Name migrations descriptively: "create_cards_table", "add_favorite_to_cards", "add_price_index"
ADDITIVE changes (add columns, create tables): apply without asking the user.
DESTRUCTIVE changes (DROP TABLE, DROP COLUMN, RENAME, changing column types): always confirm with the user before running.
Never use query for DDL — always use migrate so changes are tracked.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | DDL SQL to apply. Can include multiple statements separated by semicolons. | |
| name | Yes | Short snake_case migration name, e.g. "create_cards_table" or "add_favorite_column" | |
| databaseId | Yes | The database ID to migrate |