@earth-app/collegedb
    Preparing search index...

    Function listTables

    • Queries the SQLite system catalog to retrieve all user-created tables in the database. This is useful for schema inspection, validation, and debugging purposes.

      Parameters

      • d1: D1Database

        The D1 database instance to inspect

      Returns Promise<string[]>

      Promise resolving to array of table names, sorted alphabetically

      Returns empty array if query fails or database is inaccessible

      const tables = await listTables(env.DB_EAST);
      console.log('Available tables:', tables);
      // Output: ['posts', 'shard_mappings', 'users']

      // Check for specific table
      if (tables.includes('users')) {
      console.log('Users table exists');
      }