set_migrations_directory
Configure the directory for creating and reading migration files, with optional custom path; defaults to "pb_migrations" in the current working directory.
Instructions
Set the directory where migration files will be created and read from.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customPath | No | Custom path for migrations. If not provided, defaults to "pb_migrations" in the current working directory. |
Implementation Reference
- src/tools/migration-tools.ts:261-266 (handler)Handler function that executes the set_migrations_directory tool logic by calling setMigrationsDirectory and returning a formatted result.async function handleSetMigrationsDirectory(args: SetMigrationsDirectoryArgs): Promise<ToolResult> { const path = setMigrationsDirectory(args.customPath); return { content: [{ type: 'text', text: `Migration directory set to: ${path}` }], }; }
- src/tools/migration-tools.ts:57-66 (registration)Registration of the tool in the migrationToolInfo array, defining name, description, and input schema.{ name: 'set_migrations_directory', description: 'Set the directory where migration files will be created and read from.', inputSchema: { type: 'object', properties: { customPath: { type: 'string', description: 'Custom path for migrations. If not provided, defaults to "pb_migrations" in the current working directory.' }, }, }, },
- src/tools/migration-tools.ts:34-36 (schema)Type definition for the tool's input arguments.interface SetMigrationsDirectoryArgs { customPath?: string; }
- Core helper function implementing the directory setting logic by updating the global MIGRATIONS_DIR variable.export function setMigrationsDirectory(customPath?: string): string { if (customPath) { // Use custom path if provided // Check if the path is absolute or relative if (path.isAbsolute(customPath)) { MIGRATIONS_DIR = customPath; } else { // For relative paths, resolve from the current working directory MIGRATIONS_DIR = path.resolve(process.cwd(), customPath); } } else { // Default to pb_migrations in the project directory MIGRATIONS_DIR = path.resolve(process.cwd(), 'pb_migrations'); } return MIGRATIONS_DIR; }