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

    Function schemaExists

    • Performs a lightweight check to determine if the expected schema is present in the database.

      Parameters

      • d1: D1Database

        The D1 database instance to check

      • table: string

        The name of the table to check

      Returns Promise<boolean>

      Promise resolving to true if schema tables exist, false otherwise

      const hasSchema = await schemaExists(env.DB_NEW_SHARD, "users");
      if (!hasSchema) {
      console.log('Creating schema on new shard...');
      await createSchema(env.DB_NEW_SHARD, usersSchema);
      }