Hi guys, I have been trying to migrate our prisma ...
# prisma-migrate
d
Hi guys, I have been trying to migrate our prisma version from 2.8 -> 2.28 so we can use the new migrate function. I have deleted the old migrations and hit the
prisma migrate dev --name init
command which gives me the ouput found in the attachment. Is there a way to use the new functionality without wiping the entire database? Many thanks!
I remember @Ryan helping me fantastically in the past with something so if you have time, would be amazing if you could have a look at this ๐Ÿ™‚
Ah i have found a section about baselining your production environment here ๐Ÿ™‚ https://www.prisma.io/docs/guides/database/developing-with-prisma-migrate/add-prisma-migrate-to-a-project
r
@Daan Helsloot ๐Ÿ‘‹ Yes you would need to do the following steps: 1. Run
prisma migrate dev
on the Dev environment. This will only have to be done once and will delete all the data which is why this needs to be done only on Dev. 2. Baseline your production environment. As youโ€™re moving to the new Migrate, youโ€™ll just have a single migration for now. This you would need to baseline with your production environment and no data is lost here. Only the migration is applied.
d
Yes I will try it out thank you very much ๐Ÿ™‚
๐Ÿ™Œ 1
Hi Ryan, after following the documentation and running prisma migrate I get a bunch of errors in regard to the typings in the Prisma namespace. typescript is telling me
"'"/Users/daan/haas/api/node_modules/@prisma/client/index".Prisma' has no exported member named 'DialogueCreateInput'. Did you mean 'DialogueWhereInput'?ts(2724)"
However, when inspecting the Prisma namespace I can see the type is actually generated
r
It would be under the
Prisma
namespace:
Copy code
import { Prisma } from '@prisma/client'

type T = Prisma.DialogueCreateInput
d
I have tried retrieving it through the Prisma namespace but no luck
None of my generated create inputs are available but DialogueCreateArgs for example is ๐Ÿ˜ฌ
Actually I see a few issues in my generated Prisma namespace: 1. Cannot find name 'Enumerable'. 2. Property or signature expected.ts(1131) & 'Dialogue' only refers to a type, but is being used as a value here. 3. Cannot find name 'SortOrder'.ts(2304) 4. Cannot find name 'Decimal'.ts(2304)
Weird thing is that those types can be found inside the Prisma namespace but there other types in the same file which are not part of the namespace and they throw errors
This is the generated prisma client
After line 43753 it all seems to fall apart
export type DialogueWhereUniqueInput = {
id?: string
postLeafNodeId?: string
Dialogue.slug_customerId_unique?: DialogueDialogue.slug_customerId_uniqueCompoundUniqueInput
}
Oh i see so i know why it goes wrong: 1. Prisma introspect added a weird name to my @@unique in schema.prisma (
@@unique([slug, customerId], name: "Dialogue.slug_customerId_unique"
) 2. When the prisma client is generated this name is used as a key of one of the type attributes causing all sorts of problems
r
Could you update the
@@unique
name and check?
d
After removing the name from the @@unique it did work
So something is not correct when it comes to the prisma introspect function
As in it shouldn't generate faulty names from a postgres database created with prisma haha ๐Ÿ™‚