GDPR Is a Database Architecture Problem
Most developers treat GDPR as a legal problem.
It's actually a database architecture problem. And if you're building it in after the fact, you're already too late.
Here's what "GDPR-compliant by design" actually looks like at the database level:
Five Database-Level Principles
-
Encrypt at the column level, not just at rest
Full-disk encryption doesn't protect you when someone runs
SELECT * FROM users. Sensitive PII (name, email, DOB) needs field-level encryption. Your query layer handles decryption and compliance is enforced structurally. -
Design for the Right to Erasure from day one
"Delete the user" sounds simple but if
user_idis a foreign key across 40 tables, you have a problem. Pseudonymisation over hard deletes. Replace PII with a token, row gone, but the relationships remain intact and the audit trail is preserved. -
Data residency isn't a deployment concern, it's a schema concern
EU data must stay in EU regions but if your multi-tenant schema doesn't encode residency, your infrastructure team is making compliance decisions blind. Add a region column and enforce it at the ORM layer.
-
Audit logs are not optional
Who accessed what, and when? GDPR requires you to answer this. Append-only audit tables with
user_id,action,timestamp, andresource_id. Not in your application logs but in your database. -
Treat data minimisation as a schema review
Do you actually need
date_of_birth, or justis_over_18? Every column you don't store is a breach you can't have. Make this part of your PR review process, not your legal review.
The 72-Hour Breach Window
GDPR fines aren't the scary part.
The scary part is Article 33. You have 72 hours from awareness of a breach to notify your supervisory authority.
Not 72 hours from your security team's post-mortem. From awareness.
And under Article 34, if the risk to individuals is high, you notify affected users too: no fixed window, as fast as possible.
To notify properly you need:
- what was breached
- how many people
- what categories of data
- what you're doing about it
Try answering those questions with missing audit logs and a schema you don't fully understand.
Build It In
Build it in. It's cheaper.
I've put together a GDPR-ready database checklist covering all of this.