Models that can be ignored by migration scripts (Support for views) #15719
Labels
domain/client
Issue in the "Client" domain: Prisma Client, Prisma Studio etc.
domain/psl
Issue in the "PSL" domain: Prisma Schema Language
domain/schema
Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc.
kind/feature
A request for a new feature.
topic: schema
topic: views
Problem
The lack of support for database views have already been discussed for quite long, and various work arounds have also been suggested in those discussions. The project I work on extensively uses views to roll-up data & the task of managing them, everytime there is a migration is frustrating and error prone.
Suggested solution
Add support for viewModel or an annotation like
@view
or@ignore
in the schema file so that the migrate script can create a view instead of a table/relationship using the corresponding syntax for the target DBMS where supported or throw an error if views arent supported. Client generation can generate only read methods / keep the other methods unexported. view defenitions can take references and aggregate methods.Alternatives
View defenitions can be done by manually editing the migration sql.
The text was updated successfully, but these errors were encountered: