WaspW
Wasp12mo ago
sachdva

Database Migration Problem

Hello!
I finally found the error that confused me a lot at the beginning of wasp.
Assume we have a model
model UserMetrics {
  createdAt         DateTime @default(now())
  updatedAt         DateTime @updatedAt

  user              User?     @relation(fields: [userId], references: [id], onDelete: Cascade)
  userId            String   @id  
  credits           Int      @default(15)
  flashcardsCreated Int      @default(0)
}


Now we change this in dev to
model UserMetrics {
  createdAt         DateTime @default(now())
  updatedAt         DateTime @updatedAt

  user              User?     @relation(fields: [userId], references: [id], onDelete: Cascade)
  userId            String   @id  
  credits           Int      @default(15)
  SOMEOTHERNAMEFLASHCARD Int      @default(0)
}


In dev we will get a message to confirm this change and it will migrate. I noticed when I run my github action to prod
(similar to this) https://github.com/wasp-lang/deploy-action
There will be no migration in our database in prod, this will create major problems that I can't fix! Somewhere it says there are no migrations needed and the result is that our schema.prisma has the change, but the migration.sql wasn't run.

This migration was one that needed a manual user input in dev (just to confirm), what happens with manual user input in prod?
Was this page helpful?