{"uid":"cap_JspWhwQUS4aJ74_A4G_hp","slug":"batch-database-migration-safety-preflight-312f2018","name":"Batch Database Migration Safety Preflight","description":"Batch safety preflight for many database migrations at once: a list of objects each with a name and migration SQL. Returns a per-file pass, caution or block verdict plus a rollup with the worst verdict and counts. Migration-safety indicators, not a guarantee.","url":"https://api.agentstools.dev/migrate/batch","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"format":{"enum":["sql","alembic","auto"],"type":"string","description":"Default input format for entries that do not set one"},"dialect":{"enum":["postgres","mysql"],"type":"string","description":"Default dialect for entries that do not set one"},"migrations":{"type":"array","items":{"type":"object"},"description":"List of objects, each with name and migration SQL"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.1","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.1/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_Db4oWjnzA4tCSNNvREEFD","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.1","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Runs safety preflight checks on multiple database migration SQL files at once, returning per-file pass/caution/block verdicts plus a rollup summary.","exampleAgentPrompt":"Run a batch migration safety preflight on these three migrations: 'add_user_index' with SQL 'CREATE INDEX idx_users ON users(email);', 'drop_old_column' with SQL 'ALTER TABLE orders DROP COLUMN legacy_id;', and 'rename_table' with SQL 'ALTER TABLE sessions RENAME TO user_sessions;' — give me a verdict for each and tell me the worst overall.","exampleUseCases":[{"title":"Pre-deploy migration gate in CI/CD","prompt":"Before we deploy to production, run a safety preflight on all 5 migrations in our release: 'create_audit_log' with 'CREATE TABLE audit_log (id SERIAL PRIMARY KEY, event TEXT);', 'drop_temp_table' with 'DROP TABLE temp_imports;', 'add_fk_constraint' with 'ALTER TABLE orders ADD CONSTRAINT fk_user FOREIGN KEY (user_id) REFERENCES users(id);', 'remove_not_null' with 'ALTER TABLE products ALTER COLUMN description DROP NOT NULL;', and 'truncate_cache' with 'TRUNCATE TABLE cache;' — flag anything that should block or needs caution."},{"title":"Review risky schema changes from a developer PR","prompt":"A developer just submitted a PR with two migrations — 'delete_stale_accounts' using 'DELETE FROM accounts WHERE last_login < NOW() - INTERVAL 2 YEAR;' and 'drop_payments_column' using 'ALTER TABLE payments DROP COLUMN card_hash;' — can you safety-check both and tell me if either should be blocked?"},{"title":"Validate a full migration history before database restore","prompt":"I'm about to replay 4 historical migrations on a staging database and want to make sure none are dangerous: 'init_schema' with 'CREATE TABLE users (id SERIAL, email TEXT);', 'add_roles' with 'ALTER TABLE users ADD COLUMN role TEXT DEFAULT admin;', 'drop_indexes' with 'DROP INDEX idx_email;', and 'rebuild_fk' with 'ALTER TABLE sessions ADD FOREIGN KEY (user_id) REFERENCES users(id);' — give me a pass, caution, or block for each."}],"resultDescription":"Returns an array of per-file results each containing the migration name and a verdict of pass, caution, or block, along with a rollup object showing the worst overall verdict and counts of each verdict type across all submitted migrations. Includes migration-safety indicators that informed each decision.","failureModes":["Empty or missing migrations list returns a validation error","Malformed SQL in a migration entry may result in a parse error or automatic block verdict","Exceeding maximum batch size returns an error","Non-SQL content in migration fields may produce unreliable verdicts","Network timeout if batch is very large"],"whenToPreferThis":"Use this endpoint when you need to evaluate multiple database migrations in a single call and want a consolidated rollup verdict alongside per-file results. Prefer this over single-migration checks when running CI/CD gates, reviewing PRs with multiple migrations, or replaying migration histories. It is purpose-built for batch safety assessment of SQL migrations specifically, not general SQL linting or execution.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T06:57:09.970Z","isFirstParty":false}