PrismaPostgresBeginner
Model & field types — শক্তিশালী scalars
table-এর সারি = model — Prisma-র scalars data type।
4টি অংশবাংলা ভাষায়
Product modelprisma
prisma
model Product {
id Int @id @default(autoincrement())
name String @unique
description String?
price Decimal @default(0)
qty Int @default(0)
active Boolean @default(true)
spec Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}| Scalar | SQL |
|---|---|
| String | text / varchar |
| Int | integer (4-byte) |
| BigInt | bigint |
| Decimal | numeric — money-এর জন্য |
| Boolean | boolean |
| DateTime / Date | timestamp |
| Json | jsonb (PostgreSQL) |
?— nullable; ছাড়লে NOT NULL- @default, @unique, @id — attribute
@updatedAt— নিজে-নিজে update-তে বদলায়
money-তে Decimal
প্রাইস Float না — float round হয়। Decimal → Postgres numeric, ও Decimal.js টাইপ client-এ।
শেষ প্যারায় নিজে practice করুন — কোড কপি করে নিজের এডিটরে চালিয়ে দেখুন।