You can also draft a colonist behind the turret.
That way, when the turret gets damaged, you'll have to un-draft the colonist, priorize repairing the turret (you'll most likely have to do that multiple time, as he'll want to do something else), and re-draft him when he's done, so he can stay around for the next round.
That's quite tedious, but there's no other way to have your turret repaired when it needs it.
You also need to put your turret after some corner, so the raiders can't use their longer range to best the turret.
That way, when the turret gets damaged, you'll have to un-draft the colonist, priorize repairing the turret (you'll most likely have to do that multiple time, as he'll want to do something else), and re-draft him when he's done, so he can stay around for the next round.
That's quite tedious, but there's no other way to have your turret repaired when it needs it.
You also need to put your turret after some corner, so the raiders can't use their longer range to best the turret.