Port Stoa to SQL

Clearly mark things as transient if need be, don't touch anything else until this is complete.