My favorite data(base) fields

Fields and columns that could save you lots of time

The other kind of favorite columns

Use Enumerations instead of Booleans

CREATE TABLE users (
... # your columns
is_active BOOLEAN NOT NULL
);
case class User(..., isActive: Boolean)if user.isActive then
...
CREATE TABLE users (
... # your columns
user_status CHARACTER VARYING(255) NOT NULL
);
case class User(..., status: UserStatus)enum UserStatus:
case Active, Inactive
user.status match { 
case UserStatus.Active => ...
case UserStatus.Inactive => ...
}
enum UserStatus:
case Active, Inactive, Banned, Deleted
user.status match { 
case UserStatus.Active => ...
case UserStatus.Inactive => ...
<-----error: missing implementations for cases...help!
}
CREATE TABLE users (
... # your columns
is_active BOOLEAN NOT NULL
is_deleted BOOLEAN NOT NULL
is_banned BOOLEAN NOT NULL
);
case class User(..., isActive: Boolean, isDeleted: Boolean, isBanned: Boolean)
if user.isActive && !user.isDeleted && !user.isBanned then
...

Track source of the data

CREATE TABLE eshop_products (
... # your columns
created_by CHARACTER VARYING(255) NOT NULL
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
);
enum DataSource:
case ImportJob, UserInput, MachineLearningGenerated
enum DataSource:
case ImportJob(jobId: Int) extends DataSource
case UserInput(userId: UUID) extends DataSource
case MachineLearningGenerated(version: Long) extends DataSource