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

    Function createSchema

    • Creates the database schema in the specified D1 database

      Parameters

      • d1: D1Database

        The D1 database instance to create schema in

      • schema: string

        The SQL schema definition to execute

      Returns Promise<void>

      Promise that resolves when schema creation is complete

      If schema creation fails

      const userSchema = `
      CREATE TABLE users (
      id TEXT PRIMARY KEY,
      name TEXT NOT NULL,
      email TEXT UNIQUE
      );
      `;
      await createSchema(env.DB_NEW_SHARD, userSchema);