This process seems to work well for me, and give maximum security.
Go to the edge of the lode. Dig straight down until the dig limit. Now dig a 3×3 square away from the lode edge. Use the hoe to flatten the floor. Put down a bench, a portal, and a box. Add a fire in the corner if you like, with a thatch piece higher up to keep rain off if you are in the forest biome. Add a torch near the top on a plank in the wall to drive away gray dwarves in the forest biome. If this is deep enough, few will jump down and you are safe in your pit.
Now dig up from your area into the middle lode on an ascending path, taking ore as you go. The aim here is to emerge at the top center of the lode. If you then dig a perimeter ditch that is deep, nothing will jump in there as well. You can go down your central gopher hole to dump rock and ore as you are encumbered, and pop up to deal with stuff attacking you.
If you are mining silver, what you wind up with is a high spot in the middle with a deep trench around, keeping wolves out.
If you are mining copper, you can deep trench mine the entire lode to get all of the copper, and you are safe in your ditch.
You can dig a ramp for a cart and put a door on the ramp to keep stuff out, or just sprint wall jump your ore out to your ship as needed.
The portal in the hole lets you go back and sharpen your pick and dump excess rock at your base, and renew your rest bonus. You can also mine right up to nightfall and just port home.
If you are mining silver, a second 3×3 deep hole and a harpoon will solve golem problems. Just harpoon the golem and drag it into that pit. Drakes love to go attack that, and you can get some relief from their constant attacking.