Open stephaniesyed opened 9 months ago
I've run into this without having changed names myself updating from 2.11.2 to 2.13.0.
✔ Warnings detected during schema push:
· You're about to change versionstatus column type from enuminterests_v_version_status to _enuminterests_v_version_status_v with 2 items · You're about to change version_country column type from enumorganisations_v_version_country to _enumorganisations_v_version_country_v with 1 items · You're about to change versionstatus column type from enumnews_posts_v_version_status to _enumnews_posts_v_version_status_v with 17 items · You're about to change version_authorisation column type from enummembers_v_version_authorisation to _enummembers_v_version_authorisation_v with 100 items · You're about to change version_personTitle column type from enummembers_v_person_title to _enummembers_v_person_title_v with 100 items
DATA LOSS WARNING: Possible data loss detected if schema is pushed.
Accept warnings and push schema to database? … yes error: column "version__status" cannot be cast automatically to type _enum__interests_v_version_status_v at /data/projects/ac/payload/node_modules/pg-pool/index.js:45:11 at processTicksAndRejections (node:internal/process/task_queues:95:5) at DrizzleORMPgClient.query (/data/projects/ac/payload/node_modules/drizzle-kit/payload.js:34498:21) at apply (/data/projects/ac/payload/node_modules/drizzle-kit/payload.js:36648:9) at Object.connect (/data/projects/ac/payload/node_modules/@payloadcms/db-postgres/src/connect.ts:124:3) at BasePayload.init (/data/projects/ac/payload/node_modules/payload/src/payload.ts:359:7) at getPayload (/data/projects/ac/payload/node_modules/payload/src/payload.ts:430:22) at initHTTP (/data/projects/ac/payload/node_modules/payload/src/initHTTP.ts:33:19) at Payload.init (/data/projects/ac/payload/node_modules/payload/src/index.ts:17:21)
Example before and after column type names:
enum__interests_v_version_status
_enum__interests_v_version_status_v
I'm guessing the new types/type names are caused by https://github.com/payloadcms/payload/pull/5045 ?
Edit: I've now nuked the database in dev allowing Payload to recreate the tables upon running, and column type name is now:
_enum__interests_v_version_status_v
this was helpful, thank you @stephaniesyed
Link to reproduction
No response
Describe the Bug
When an enum get renamed, the generated migration file tries to change the data type for the column that uses it, but it fails.
The file has
Which results in the following error when trying to migrate:
Changing the second line to