Skip to content

[BUG]: error attempting to drizzle-kit migrate table with char array field generated using drizzle-kit generate #5370

@coeternity7

Description

@coeternity7

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

1.0.0-beta.15-859cf75

What version of drizzle-kit are you using?

1.0.0-beta.15-859cf75

Other packages

No response

Describe the Bug

On a fresh local Postgres DB with Podman, I generated migrations with drizzle-kit generate and attempted to apply them with drizzle-kit migrate. The migration failed, only indicating a specific table with no error message. I narrowed down the failing column by removing 'complex' columns until the migration succeeded.

The failing column was this:

colorArrayField: char({length:7}).array().notNull().default(["#6ddf5b", "#418536", "", "", "", "", ""])

which on 1.0.0 beta-15 evaluated to this after using drizzle-kit generate:

"colorArrayField" char(7)[] DEFAULT '{#6ddf5b,#418536,,,,,}'::char(7)[] NOT NULL,

drizzle-kit migrate would then fail the migration if this column was present in the table.


Under the previous non-beta version of ORM/Kit, the same schema pattern (including specified array length which didn't seem to be valid syntax under 1.0.0) would instead generate this:

"colorArrayField" char(7)[7] DEFAULT '{"#6ddf5b","#418536","","","","",""}' NOT NULL,

Replacing the column generated by the new version with the code generated by the old version allowed the migration to proceed without error.

Array columns in another table which followed the default empty array pattern exactly as described here and generated under 1.0.0 beta 15 worked with no migration error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug/fixed-in-betaThis bug has been fixed in beta (or will be soon).

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions