image.png

In the previous step, we only studied Entities (Tables) β€” for example:

User, Tweet, Profile, Comment, etc.

An Entity represents a real-world object that stores data in our database.

Now we’ll add Attributes (also called Columns) to each entity.

πŸ‘‰ Attributes are the details or properties of an entity.

Example:

These attributes help us describe our data clearly and later connect entities together using relationships (like one-to-one, one-to-many, many-to-many).

Let’s start adding attributes πŸ‘‡


πŸ§‘β€πŸ’» Users Table

Every user will have basic login details and verification status.

We are storing email, username, and password for authentication.

Later we’ll connect users to other tables using the id field (which is the Primary Key).

model Users {
  id          String   @id @default(uuid())   # Unique ID for each user
  username    String   @unique               # User's display name (must be unique)
  password    String                         # Encrypted password for login
  email       String   @unique               # Email used during signup
  isVerified  Boolean  @default(false)       # Whether user has blue tick or not
  createdAt   DateTime @default(now())       # Account creation time
  updatedAt   DateTime @default(now())       # Record update time
}