Naghell
Naghell
PPrisma
Created by Naghell on 1/30/2025 in #help-and-questions
Existing MySQL to Postgres
I tried this: https://github.com/prisma/prisma/discussions/20025 Now I get this:
⚠️ Warnings for the current datasource:

• You are about to drop the `academy` table, which is not empty (2 rows).
• You are about to drop the `academyconfig` table, which is not empty (1 rows).
• You are about to drop the `academydomain` table, which is not empty (1 rows).
• You are about to drop the `academyseo` table, which is not empty (1 rows).
• You are about to drop the `academystyle` table, which is not empty (1 rows).
• You are about to drop the `audience` table, which is not empty (132 rows).
• You are about to drop the `category` table, which is not empty (10 rows).
• You are about to drop the `course` table, which is not empty (230 rows).
• You are about to drop the `courseinscription` table, which is not empty (35 rows).
• You are about to drop the `coursesubcategory` table, which is not empty (163 rows).
• You are about to drop the `event` table, which is not empty (328 rows).
• You are about to drop the `lead` table, which is not empty (225 rows).
• You are about to drop the `milestone` table, which is not empty (1687 rows).
• You are about to drop the `paymentintent` table, which is not empty (16 rows).
• You are about to drop the `price` table, which is not empty (126 rows).
• You are about to drop the `role` table, which is not empty (6 rows).
• You are about to drop the `subcategory` table, which is not empty (17 rows).
• You are about to drop the `user` table, which is not empty (221 rows).
• You are about to drop the `usercourse` table, which is not empty (187 rows).
• You are about to drop the `userrole` table, which is not empty (235 rows).

√ Are you sure you want to create and apply this migration? ...
⚠️ Warnings for the current datasource:

• You are about to drop the `academy` table, which is not empty (2 rows).
• You are about to drop the `academyconfig` table, which is not empty (1 rows).
• You are about to drop the `academydomain` table, which is not empty (1 rows).
• You are about to drop the `academyseo` table, which is not empty (1 rows).
• You are about to drop the `academystyle` table, which is not empty (1 rows).
• You are about to drop the `audience` table, which is not empty (132 rows).
• You are about to drop the `category` table, which is not empty (10 rows).
• You are about to drop the `course` table, which is not empty (230 rows).
• You are about to drop the `courseinscription` table, which is not empty (35 rows).
• You are about to drop the `coursesubcategory` table, which is not empty (163 rows).
• You are about to drop the `event` table, which is not empty (328 rows).
• You are about to drop the `lead` table, which is not empty (225 rows).
• You are about to drop the `milestone` table, which is not empty (1687 rows).
• You are about to drop the `paymentintent` table, which is not empty (16 rows).
• You are about to drop the `price` table, which is not empty (126 rows).
• You are about to drop the `role` table, which is not empty (6 rows).
• You are about to drop the `subcategory` table, which is not empty (17 rows).
• You are about to drop the `user` table, which is not empty (221 rows).
• You are about to drop the `usercourse` table, which is not empty (187 rows).
• You are about to drop the `userrole` table, which is not empty (235 rows).

√ Are you sure you want to create and apply this migration? ...
9 replies
PPrisma
Created by Naghell on 1/30/2025 in #help-and-questions
Existing MySQL to Postgres
9 replies
PPrisma
Created by Naghell on 1/30/2025 in #help-and-questions
Existing MySQL to Postgres
And I also get several supposed changes.
model UserRole {
userId Int
roleId Int
academyId Int @default(1)
user User @relation(fields: [userId], references: [id])
role Role @relation(fields: [roleId], references: [id])
academy Academy @relation(fields: [academyId], references: [id])

@@id([userId, roleId, academyId])
}

[*] Changed the `UserRole` table
[-] Removed foreign key on columns (academyId)
[-] Removed foreign key on columns (roleId)
[-] Removed foreign key on columns (userId)
model UserRole {
userId Int
roleId Int
academyId Int @default(1)
user User @relation(fields: [userId], references: [id])
role Role @relation(fields: [roleId], references: [id])
academy Academy @relation(fields: [academyId], references: [id])

@@id([userId, roleId, academyId])
}

[*] Changed the `UserRole` table
[-] Removed foreign key on columns (academyId)
[-] Removed foreign key on columns (roleId)
[-] Removed foreign key on columns (userId)
9 replies
PPrisma
Created by Naghell on 1/30/2025 in #help-and-questions
Existing MySQL to Postgres
The first step works fine, and I have no problem, but when I move on to the second one to apply the migration, it shows me this message again.
Drift detected: Your database schema is not in sync with your migration history.

The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.

It should be understood as the set of changes to get from the expected schema to the actual schema.

? We need to reset the "dev" schema at "localhost:5432"
Do you want to continue? All data will be lost. » (y/N)
Drift detected: Your database schema is not in sync with your migration history.

The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.

It should be understood as the set of changes to get from the expected schema to the actual schema.

? We need to reset the "dev" schema at "localhost:5432"
Do you want to continue? All data will be lost. » (y/N)
9 replies