SQL script, added type-g, type-gm, added old version of device and type-f