Rewrite the service
and nobody notices.
Rename a column
and something breaks
in a country you do not support.
Code is soft.
Data is not.
You can throw away
every line you wrote this year
and start again
in a new language next spring.
The table stays.
The rows in it
were written by real people
doing real things
on days you cannot repeat.
You cannot regenerate them.
You cannot roll them back
by reverting a commit.
That is why the schema
deserves the slow conversation
the code never gets.
Not because it is hard to change.
Because it is expensive
to change wrongly.
A nullable column
is a question you failed to answer.
A string holding three kinds of thing
is a decision you postponed,
and it will be paid for
by whoever writes the report
in two years.
An enum kept as free text
is a promise
you did not ask the database
to help you keep.
So spend the extra hour.
Name the field
for the fact it records,
not the screen that shows it.
Write down what empty means,
because it will mean
four different things
by Christmas
if you do not.
Add the constraint
while the table is small.
You will never get
a quieter moment than now.
And when you migrate,
migrate forward.
Write to both.
Read from one.
Then switch.
Never a big bang
on a Friday.
Frameworks arrive and leave.
Languages come into fashion.
The service gets rewritten
by people who never met you.
The data walks through all of it,
carrying every assumption
you made on a Tuesday
and never said out loud.
The code is your handwriting.
The data is the record.
One you can rewrite tonight.
The other is already sitting
in somebody's statement,
somebody's invoice,
somebody's history.
Every guess you encode into it
becomes a fact
to everyone who reads it later.
Design for that.
Treat the schema
as the part of the system
that will outlive
your opinion of it.
– Serguey Asael Shinder
Top comments (0)