Mysql Geo index

export const property = mysqlTable(
  "properties",
  {
    id: int("id").primaryKey().autoincrement(),
    longitude: float("longitude").notNull(),
    latitude: float("latitude").notNull(),
    primaryImageUrl: varchar("primary_image_url", { length: 255 }),
    jsonData: json("json").$type<{ foo: string }>(),
    createdAt: timestamp("created_at", { mode: "string" }).defaultNow(),
  },
  (table) => ({
    latIndex: index("lat").on(table.latitude),
    longIndex: index("long").on(table.longitude),
  })
);


this is what I generated

CREATE INDEX `lat` ON `properties` (`latitude`);--> statement-breakpoint
CREATE INDEX `long` ON `properties` (`longitude`);


any idea how can I make drizzle generate this kind of index?

 alter table properties add index lat(latitude);
 alter table properties add index long(longitude);


thank you
Was this page helpful?