prisma1-upgrade icon indicating copy to clipboard operation
prisma1-upgrade copied to clipboard

suggested SQL statements to set DEFAULT values are wrong

Open omar-dulaimi opened this issue 4 years ago • 2 comments

Hello,

I'm going through the steps to upgrade from prisma 1.13 to 2.17 and so far it was a pleasant experience. However, I came across an issue with the generated SQL statements to fix the DEFAULT constraint on many fields, please see below for a comparison between datamodel and generated SQL:

datamodel:

    status: AdStatus @default(value: "DRAFT")
    displayMode: AdDisplayModeType @default(value: "SINGLE")

suggested SQL statements:

    ALTER TABLE `Ad` CHANGE `status` `status` MEDIUMTEXT  DEFAULT 'DRAFT';
    ALTER TABLE `Ad` CHANGE `displayMode` `displayMode` MEDIUMTEXT  DEFAULT 'SINGLE';

as you can see:

  • status is an enum field with a default value of DRAFT, but SQL is MEDIUMTEXT the same applies to displayMode

using Prisma v1.13

omar-dulaimi avatar Feb 17 '21 20:02 omar-dulaimi

Any Updates on this how you fix this problem. this issue still there in upgrade CLI please help to fix this problem.

da201501245 avatar Apr 12 '22 11:04 da201501245

Do these SQL statements fail because of this? What is the type of the columns before? (Is it possible that enums from Prisma 1 are stores as mediumtext by default?)

janpio avatar Apr 12 '22 15:04 janpio