Skip to content

Instantly share code, notes, and snippets.

@mimoo
Created February 6, 2026 22:17
Show Gist options
  • Select an option

  • Save mimoo/549124666de4fd7be8ee6c8dc8f6ccd4 to your computer and use it in GitHub Desktop.

Select an option

Save mimoo/549124666de4fd7be8ee6c8dc8f6ccd4 to your computer and use it in GitHub Desktop.

Revisions

  1. mimoo created this gist Feb 6, 2026.
    45 changes: 45 additions & 0 deletions no-more-db-push.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    # NO MORE DB PUSH

    Annoying agents. Claude, codex, gemini, they all suck, they always use `db push` directly with prisma and co. We don't want them to! So we must tell them to stop!!!!

    Add to .claude/settings.json in your project:

    ```json
    {
    "hooks": {
    "PreToolUse": [
    {
    "matcher": "Bash",
    "hooks": [
    {
    "type": "command",
    "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-prisma-db-push.sh"
    }
    ]
    }
    ]
    }
    }
    ```

    Then create `.claude/hooks/block-prisma-db-push.sh:`


    ```bash
    #!/bin/bash
    INPUT=$(cat)
    COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command')

    if echo "$COMMAND" | grep -q "prisma db push"; then
    jq -n '{
    hookSpecificOutput: {
    hookEventName: "PreToolUse",
    permissionDecision: "deny",
    permissionDecisionReason: "NEVER use prisma db push — it bypasses migration history. Use bun run db:migrate:dev instead. If that fails due to drift,
    ask the user."
    }
    }'
    fi
    ```

    And chmod +x it.