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
24.49k stars 643 forks source link

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

Open richardkyk opened 5 months ago

richardkyk commented 5 months 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

StefaniaMan314 commented 3 months ago

Any updates on this? Happens for me as well:

drizzle-kit: v0.23.1
drizzle-orm: v0.32.1

Screenshot from 2024-07-31 14-01-41

Would appreciate any suggestions on how to fix it, thanks.