Harden the schools. Make the buildings a single-entry area, with something called a “man-trap”. A man-trap consists of a set of two interlocking doors that cannot be open simultaneously. Enter first door, and the first door has to close before the second door can be opened. Keep this vestibule area under constant video surveillance, and put the entry and passage doors under the control of an operator. The outer door may open, but the passage door cannot.
The operator can be the school resource officer, preferably trained in use of and carrying weapons of some kind. This alone will provide a precious few minutes of stalling the prospective attacker, and may spell the difference between a massacre and a capture, until the authorities arrive.
Do away with the schools and make the kids go online.
Let the teachers find new jobs.