I wonder if instead of having columns of only magma, have alternating columns in such a way that if they don't directly breach only a single column (in that case, they'll be pushed back by the water or magma) then they will diagonally breach both, in which case they both flow into the gap, sealing it in obsidian. Hmm. I wonder how we can deal with a direct breach of a single column, and if there is a way to make it auto-sealing like the enemy trying to dig between the columns would cause...
This gave me another idea.
Another possibility is a grid:
W = vertical shafts full of water
M = vertical shafts full of magma
X = wall
(fort goes here)
XXXXXXXXX
XWXMXWXMX
XXXXXXXXX
XMXWXMXWX
XXXXXXXXX
XWXMXWXMX
XXXXXXXXX
XXXXXXXXX
XXXXXXXXX
(invaders go here)
Those shafts are channeled shafts, and not columns of up/down stairs. This is to prevent things from crossing right through a vertical shaft without breaching the opposite liquid shaft on the other side. It is unlikely diggers will be able to do so while flying or swimming, or across a full 1z gap.
The supply for it at the top is rather complex, but nothing any player advanced enough to be doing something like this can't handle. I created a diagram to explain a rather simple method of filling these shafts from the top (so that they're pressurized).
In this diagram, the water is supplied to the large blue square from one z-level above it. The magma is supplied from that level. The right side is the fort side. The top one is one z-level above the bottom one. This area is, by nature, constructed above the surface within your walls. The big arrows show possible supply points for pressurized water / magma.
My advise would be to build this in sections, each one hydraulically isolated from the other in case one section is breached and thus depressurized. This would ensure the integrity of other sections in case of an attack there. A drain should be included in the bottom of each section to allow for the draining and repair of damaged parts. I advise drop hatches into a large cistern under each shaft to allow for quick drainage and repair, even for the magma columns. Drainage of the cistern is optional - you could always just obsidianize whatever lands down there and dig it out again.
A corner:
This is also the part where I put in a needless disclaimer that you should never use just one line of defense - if that line fails for any reason, you're screwed. Defense in depth is key, the goal of this is not to stop an enemy forever but to slow an enemy this cannot destroy long enough for active defenses to respond.. I will note it will stop most things forever by the nature of
magma.