Add verification level to ai catalog items
What does this MR do and why?
Related to #572169 (closed)
This change introduces a new verification_level feature to the ai_catalog_items model. It adds a new enum column to represent how verified or trusted each AI catalog item is, with a default value of 0 (unverified).
To support efficient querying, a database index is added on the verification_level column. Additionally, a scope is defined in the AiCatalogItem model to allow filtering records based on their verification level.
How to set up and validate locally
Enable the global_ai_catalog feature flag.
- Checkout the branch.
- Run the database migration.
- Confirm that existing Ai::Catalog::Item records have the default verification_level set to unverified.
- Verify that only the values defined in ::Namespaces::VerifiedNamespace::VERIFICATION_LEVELS are allowed for the verification_level field.
DB query performance
Query:
EXPLAIN SELECT * FROM ai_catalog_items WHERE verification_level = 0
Result:
Index Scan using index_ai_catalog_items_on_verification_level on ai_catalog_items
(cost=0.14..2.16 rows=1 width=123)
(actual time=0.057..0.065 rows=12 loops=1)
Index Cond: (verification_level = 0)
Planning Time: 0.186 ms
Execution Time: 0.102 ms
Edited by Jaydip Pansuriya