Report hasn't been filed before.
What version of drizzle-orm are you using?
1.0.0-beta.2-0f52822
What version of drizzle-kit are you using?
1.0.0-beta.2-0f52822
Other packages
No response
Describe the Bug
Drizzle Kit is not ignoring the order of json object keys when diffing the default of a Postgres (v17) jsonb column for the command drizzle-kit push.
Repro
- Define a default value for a
jsonb column
data: jsonb('data')
.$type<SomeType>()
.notNull()
.default({
b: 2,
a: 1,
})
Notice the key b is defined before a.
- Run
drizzle-kit push
- Confirm the initial column def. E.g.
ALTER TABLE public.myTable ADD "data" jsonb DEFAULT '{"a": 1, "b": 2}'::jsonb NOT NULL;
- Run
drizzle-kit push again
Expected vs. Actual
I expect the push command to complete since no changes are necessary. However, we see that drizzle-kit wants to update the default value of the column again:
┌─── public.myTable.data column changed:
│ default: '{"bar": {"a": 1, "b": 2}}' -> '{"b":2,"a":1}'
├───
│ ALTER TABLE "myTable" ALTER COLUMN "data " SET DEFAULT '{"b":2,"a":1}';
└───
Note
drizzle-kit won't update the column again if the order of the keys b and a are swapped (a first, then b).
Also, a quick shoutout to all of the maintainers for the beta release. Many longstanding bugs in drizzle-kit don't happen anymore and I'm really happy to use it more now.
Report hasn't been filed before.
What version of
drizzle-ormare you using?1.0.0-beta.2-0f52822
What version of
drizzle-kitare you using?1.0.0-beta.2-0f52822
Other packages
No response
Describe the Bug
Drizzle Kit is not ignoring the order of json object keys when diffing the default of a Postgres (v17) jsonb column for the command
drizzle-kit push.Repro
jsonbcolumnbis defined beforea.drizzle-kit pushALTER TABLE public.myTable ADD "data" jsonb DEFAULT '{"a": 1, "b": 2}'::jsonb NOT NULL;drizzle-kit pushagainExpected vs. Actual
I expect the push command to complete since no changes are necessary. However, we see that
drizzle-kitwants to update the default value of the column again:Note
drizzle-kitwon't update the column again if the order of the keys b and a are swapped (a first, then b).