prisma / prisma1

💾 Database Tools incl. ORM, Migrations and Admin UI (Postgres, MySQL & MongoDB) [deprecated]
https://v1.prisma.io/docs/
Apache License 2.0
16.56k stars 867 forks source link

Self-relation column order? #5161

Closed terion-name closed 2 years ago

terion-name commented 3 years ago

I am currently migratiing from prisma1 to prisma2 and there is question in scope of data migrating.

If we have a self-relation (a parent-children tree for example or a many-to-many graph), I can't determine what side what in relation table will be? I can obviously check it for certain cases by data, but I need a rule to make a migration script for multiple projects.

E.g.

type Unit {
    id: ID! @id
    managedBy: Unit @relation(name: "Manage" link: TABLE)
    manages: [Unit!]! @relation(name: "Manage")
}

In this case managedBy is in A column and manages in B, but why? Because of parent-child relation? If yes then what it would by in M2M? Or because of field names and alphabetical ordering?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.