Initial value for data in my table
Greeting
I want add initial value zero for this table
How can i do it ?

3 Replies
Skipping coffee for instant knowledge! Let's brew that AI answer now.
To add an initial value of zero for a field in your Greeting table using Prisma, you can use the
@default attribute in your Prisma schema. Here's how you can do it:
In this example, the data field is set to have a default value of 0 using @default(0). This means that when you create a new Greeting record without explicitly setting a value for data, it will automatically be set to 0.
This approach is supported for various data types, including Int, as shown in the Prisma schema reference.
After making this change to your schema, you'll need to create and apply a migration to update your database schema. You can do this using the following Prisma CLI commands:
1. Generate a migration:
2. Apply the migration:
These steps will ensure that your database schema reflects the changes you've made in your Prisma schema, including the default value for the data field.Hi @ALhanouf
I'm checking in to see if this question is resolved for you by the bot?
✅ Great, thanks for letting us know that this solved your question!