Modified query to support non-default database schemas.
Added versioning scheme and incremented version.