Relates #1409
Add the required SQL functions and changes to the database model to allow filtering packages from the database in the SQL storage indexer depending on the agent.version condition.
This would be similar to the changes performed to allow filtering by the Kibana condition in #1442.