list_migrations
View applied database migrations to track schema changes and deployment history in self-hosted Supabase instances.
Instructions
Lists applied database migrations recorded in supabase_migrations.schema_migrations table.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/list_migrations.ts:31-51 (handler)The execute handler function that runs an SQL query to list applied Supabase migrations from the schema_migrations table, handles potential errors if the table doesn't exist, and returns the parsed result.
execute: async (input: ListMigrationsInput, context: ToolContext) => { const client = context.selfhostedClient; // SQL to query the Supabase migrations table const listMigrationsSql = ` SELECT version, name, inserted_at FROM supabase_migrations.schema_migrations ORDER BY version `; // This table might not exist if migrations haven't been run // The RPC call will handle the error, which handleSqlResponse will catch const result = await executeSqlWithFallback(client, listMigrationsSql, true); return handleSqlResponse(result, ListMigrationsOutputSchema); }, - src/tools/list_migrations.ts:7-11 (schema)Zod schema for the tool's output: an array of objects containing migration version, name, and inserted_at timestamp.
const ListMigrationsOutputSchema = z.array(z.object({ version: z.string(), name: z.string(), inserted_at: z.string(), // Keep as string from DB })); - src/tools/list_migrations.ts:14-15 (schema)Zod schema for the tool's input (empty object, no parameters required).
const ListMigrationsInputSchema = z.object({}); type ListMigrationsInput = z.infer<typeof ListMigrationsInputSchema>; - src/index.ts:102-102 (registration)Registration of the listMigrationsTool in the availableTools object used by the MCP server.
[listMigrationsTool.name]: listMigrationsTool as AppTool, - src/index.ts:13-13 (registration)Import of the listMigrationsTool for registration in the main index file.
import { listMigrationsTool } from './tools/list_migrations.js';