move sql to create cache tables