drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
21.47k stars 486 forks source link

[BUG]: Geometry config type doesn't appear to affect the output sql #2454

Open richardkyk opened 3 weeks ago

richardkyk commented 3 weeks ago

What version of drizzle-orm are you using?

0.31.1

What version of drizzle-kit are you using?

0.22.2

Describe the Bug

When running npx drizzle-kit push I'm getting the warning

[✓] Pulling schema from database... Warning  Found data-loss statements:
· You're about to change location column type from geometry(Point) to geometry(point) with 1 items

I'm using Supabase with the PostGIS extension which has the type as "Point",

// schema.ts
export const addresses = createTable(
  "address",
  {
    id: text("id").primaryKey(),
    location: geometry("location", {
      type: "point", // <--
      srid: 4326,
      mode: "xy",
    }).notNull(),
  },
  (table) => ({
    locationIndex: index("location_idx").using(
      "gist",
      table.location,
    ),
  }),
);

It appears that changing the type has no affect in the output sql.

Expected behavior

The output sql should reflect the type when specified in the geometry config.

Environment & setup

No response