[DEV] sql refactoring

neuro-migrations broken up into phases, sql simplified and support for
scope reduction added.