#Find column usages

3 messages · Page 1 of 1 (latest)

autumn star
#

Given a database column, how do you find all the usages it has in a code base?

woeful dockBOT
#

Hi @autumn star. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To find all usages of a specific database column in a Convex codebase, there isn't a built-in feature to automatically detect this. However, you can follow a manual approach to audit your codebase. Here are some steps you can take:

  1. Search for field references: Look for instances where you're using q.field() with the specific column name. For example, if you're looking for usages of a "regionId" field, you might search for q.field("regionId") in your codebase.

  2. Audit your queries: As suggested in Queries that scale, search for .filter((q) calls in your codebase. This will help you identify places where you're filtering database results, which often involve field references.

  3. Check data modifications: Look for instances where you're updating the field. As mentioned in Queries that scale, scan for .replace( and .patch( operations in your code.

  4. Examine your schema: Review your schema definitions to see where the field is defined and if it's used in any indexes.

  5. Use your IDE's search functionality: Most modern IDEs have powerful search capabilities. You can use these to search for the column name across your entire project.

Remember, this process is manual and may require careful examination of your codebase. Convex doesn't currently provide an automated way to track all usages of a specific column across your project.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: