Replies: 1 comment
|
Hello! We are using The columns are created with something like: Schema looks like this: Since it's done at the db level the data is guaranteed consistent, you don't have to manually calculate the value when retrieving data and you can use it like any column i.e. order by without using They use So using If I run But this is not the same as the above as it will only set the value once. |
Uh oh!
There was an error while loading. Please reload this page.
A long time ago, Prisma used the
@defaultvalue/functiondbgenerated()to represent default values that could not be expressed in@defaultdirectly.Later we added a string parameter to the
dbgenerated()function, so you can now actually define whatever should be put into theDEFAULTvalue in the generated migration. We also updated Prisma's Introspection to use@default(dbgenerated("..."))when encountering default values that do not fit into@defaultdirectly.Since then
dbgenerated()is technically not necessary any more in Prisma.We are now thinking about removing
dbgenerated()as a valid value of@defaultand make it a Schema validation error instead in a future version of Prisma. Of course, we do not want to cause unneeded work and trouble for users that currently still havedbgenerated()in their Prisma schema, and hence are asking you for feedback if your project is currently still usingdbgenerated():prisma db pull) create a schema with@default(dbgenerated())for your database? If so, please answer with the relevant snippet of your Prisma schema and also the underlying database SQL schema. Does it still happen with recent Prisma versions (4.16.2 and up)?dbgenerated()manually? If so, please answer with why you chose to not define the actual default value for the field or usedbgeneratedwith a string parameter. Does Prisma Introspection (prisma db pull) overwrite the emptydbgenerated()with a more useful value for you? Can you cleanly run migrations afterwards?dbgenerated()for some other reason? Please comment and explain below.Thanks!
All reactions