Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prisma db migration always altering my table contains mysql TIME data type inside of it #9769

Closed
erzhae opened this issue Oct 14, 2021 · 3 comments · Fixed by prisma/prisma-engines#3515
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. tech/engines Issue for tech Engines. topic: dates / DateTime topic: @db.Time Native type `Time` topic: endless migrations topic: migrate topic: mysql
Milestone

Comments

@erzhae
Copy link

erzhae commented Oct 14, 2021

Bug description

Prisma DB migration file generator always altering my table contains Mysql TIME data type inside of it.

How to reproduce

I have a schema.prisma that one of my table contains MySQL TIME

model Agenda {
  id Int @id @default(autoincrement())
  name String @db.VarChar(128)
  dateStart DateTime @db.Date @map("date_start")
  dateEnd DateTime @db.Date @map("date_end")
  timeStart DateTime? @db.Time @map("time_start")
  timeEnd DateTime? @db.Time @map("time_end")
}

[Problem] Every time I edit my schema.prisma and generate a migration file, the generated file always altering my table which contains Mysql TIME, like:

ALTER TABLE `school_agenda` ADD COLUMN `testMigration` VARCHAR(191),
    MODIFY `time_start` TIME,  // << Always generated
    MODIFY `time_end` TIME;   // << Always generated`

Expected behavior

No response

Prisma information

model Agenda {
  id Int @id @default(autoincrement())
  name String @db.VarChar(128)
  dateStart DateTime @db.Date @map("date_start")
  dateEnd DateTime @db.Date @map("date_end")
  timeStart DateTime? @db.Time @map("time_start")
  timeEnd DateTime? @db.Time @map("time_end")
}

Environment & setup

  • OS: Mac OS
  • Database: MySQL
  • Node.js version: Node.js 14.17.5

Prisma Version

{
  "prisma": "^3.2.1",
  "@prisma/client": "^3.2.1"
}
@erzhae erzhae added the kind/bug A reported bug. label Oct 14, 2021
@janpio janpio added bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. team/schema Issue for team Schema. topic: migrate topic: datetime labels Nov 19, 2021
@pantharshit00
Copy link
Contributor

Thanks for the report, I can reproduce this.

@pantharshit00 pantharshit00 added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. labels Dec 8, 2021
@janpio janpio added the tech/engines Issue for tech Engines. label Mar 24, 2022
@RicckVale
Copy link

There's a fix? I have the same problem.

@janpio
Copy link
Member

janpio commented Jun 22, 2022

No, this is a confirmed bug that we could not work on. We will update the issue if that changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. tech/engines Issue for tech Engines. topic: dates / DateTime topic: @db.Time Native type `Time` topic: endless migrations topic: migrate topic: mysql
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants