fix db query before table creation