...and pushing it with npx drizzle-kit push will succeed. However, if I insert anything with the following snippet:
import { drizzle } from 'drizzle-orm/node-postgres'
import * as schema from './schema'
const db = drizzle(process.env['POSTGRESQL_DB'], { schema })
db.insert(schema.testTable).values({
bbox: [0, 1, 2, 3]
}).then(console.log)
...and later try npx drizzle-kit push, I will get the following:
$ npx drizzle-kit push
No config path provided, using default 'drizzle.config.ts'
Reading config file '/home/vignette/Projects/drizzle-bugreport/drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
Warning Found data-loss statements:
· You're about to change bbox column type from real[] to real[4] with 1 items
THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED
Do you still want to push changes?
[x] All changes were aborted
More over, the pulled schema does not contain the array size restrictions. Here's the output of npx drizzle-kit pull's schema.ts:
import { pgTable, serial, real } from "drizzle-orm/pg-core"
import { sql } from "drizzle-orm"
export const testTable = pgTable("test_table", {
testId: serial("test_id").primaryKey().notNull(),
bbox: real().array(),
});
Report hasn't been filed before.
What version of
drizzle-orm
are you using?^0.36.3
What version of
drizzle-kit
are you using?^0.28.1
Other packages
tsx@4.19.2
Describe the Bug
Apolgies if this has been reported, as I couldn't find it. Using PostgreSQL, and
node-postgres
with drizzle. Specifying the schema as such:...and pushing it with
npx drizzle-kit push
will succeed. However, if I insert anything with the following snippet:...and later try
npx drizzle-kit push
, I will get the following:More over, the pulled schema does not contain the array size restrictions. Here's the output of
npx drizzle-kit pull
'sschema.ts
: