Moving trigger sql to a gist. #1188