Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Teamβ€’3y agoβ€’
4 replies
hotshoe

planetscale: how to index col using drizzle?

Hi, seems most of the samples are pg. I'm using planetscale, and no having any luck figuring out how to index a col. here's simple table I'm wanting to use to test/eval:

import {
  varchar,
  text,
  mysqlTable,
  timestamp,
} from "drizzle-orm/mysql-core";

export const users = mysqlTable(
  "users",
  {
    id: varchar("id", { length: 16 }).primaryKey(),
    email: varchar("email", { length: 320 }),
    name: text("name").notNull(),
    createdAt: timestamp("created_at").defaultNow().notNull(),
    updatedAt: timestamp("updated_at").defaultNow().notNull(),
  },
  (table) => ({
    // how to index email?
  })
);
import {
  varchar,
  text,
  mysqlTable,
  timestamp,
} from "drizzle-orm/mysql-core";

export const users = mysqlTable(
  "users",
  {
    id: varchar("id", { length: 16 }).primaryKey(),
    email: varchar("email", { length: 320 }),
    name: text("name").notNull(),
    createdAt: timestamp("created_at").defaultNow().notNull(),
    updatedAt: timestamp("updated_at").defaultNow().notNull(),
  },
  (table) => ({
    // how to index email?
  })
);

Any help much appreciated. Thanks!
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

planetscale mysql serial col error
Drizzle TeamDTDrizzle Team / help
17mo ago
Drizzle / PlanetScale : (How to properly handle replicas)
Drizzle TeamDTDrizzle Team / help
2y ago
How to Connect drizzle client to Cloudflare/Planetscale
Drizzle TeamDTDrizzle Team / help
5mo ago
Drizzle Kit + Planetscale example?
Drizzle TeamDTDrizzle Team / help
3y ago