ProductsModulesPricingBlogAbout PL Log in See demo

Why we built a separate RoPA register even though we already had ProcessingActivity

We had ProcessingActivity from Sprint D and RcpEntry from the main GDPR module. Two models, the same data, zero synchronization. After a year, we made a call.

So. Sprint D, a long time ago. We were building the DPIA flow and it turned out we needed a model for a single processing activity. ProcessingActivity was born. Back then.

Half a year later; the GDPR module, RoPA per Art. 30. We needed a register. Someone (me) wrote a separate model called RcpEntry. “Because ProcessingActivity has different fields.” It does. But not that different.

TL;DR

  • Two models for the same thing = guaranteed data drift within a year
  • Trying to merge them gradually through a "shared interface" gets you nowhere
  • Better to rip the bandage off: pick one model, migrate, delete the other
  • The full merge took us 3 days; the daily sanity loss; 6 months

The problem; how it was drifting in production

Data categories were duplicated. Sometimes properly linked, sometimes not. A DPIA pulled its list from ProcessingActivity once, while the client was reading it from RcpEntry. I said “it’s there, you just have to click the second tab.” Client: “then why are there two tabs.”

That would have been fine if it were just views. Both places had a legalBasis field. In one it was an enum, in the other a string. The DPIA PDF export was generated from the second one. Client changes it in the first; PDF does not change. The DORA-007 signal (DPIA outdated) did not fire because it was watching the second one.

Pitfall: "Two models can be reconciled with a TypeScript shared interface." They can. But Prisma does not look at interfaces; it only looks at the schema. And when someone adds a field to just one of them, the other falls behind. Three months and they are already out of sync.

The decision; drop ProcessingActivity, keep RcpEntry

The choice was arbitrary; both models were equally extendable. I went with RcpEntry because the name is unambiguous (Records of Processing Activities), while ProcessingActivity is Western jargon that nobody in a Polish DPO’s office actually uses.

Decision: one model, RcpEntry. ProcessingActivity dropped via @@map() onto RcpEntry, then fully removed after 2 sprints with a legacy resolver for old IDs.

The solution; how to do this without stopping production

Three stages: first, migrate the remaining fields from ProcessingActivity into RcpEntry. Then switch all code paths to write to RcpEntry. Then data migration; backfill RcpEntry from existing ProcessingActivity records. Then drop ProcessingActivity.

Step 1; extend the schema

Fields that only existed in ProcessingActivity (e.g. retentionPeriodDays, profilingFlag) land in RcpEntry. Prisma migration generates nullable columns. No API changes yet.

Step 2; dual writes (transitional)

The endpoint that used to create ProcessingActivity now also creates RcpEntry. Same ID (UUID), same data. We watched for a week to see if they stayed in sync. They did.

Step 3; historical backfill

A Prisma script that walks all ProcessingActivity records and creates corresponding RcpEntry rows. 4,212 records, 9 seconds. Sanity check: count(distinct id) matches across both tables.

Step 4; switch reads

Every place that was reading from ProcessingActivity now reads from RcpEntry. Search and replace plus an ESLint rule blocking prisma.processingActivity.* (we already do this for DoraSupplier).

Step 5; drop

After two weeks of confidence; DROP TABLE processing_activity. Backup database retained for 30 days.

Win: one register. The client sees the same thing the system does. DPIA prefill works. DOCX export has consistent data. Signals fire on accurate data.

What we ruled out

The idea of keeping both models and syncing them via a database trigger. It works, but every schema change requires updating the trigger and that comes back to haunt you a year later. Better to pick one and move on.

Second; the idea of leaving ProcessingActivity as a “view” over RcpEntry. Possible, but it creates two places to look and nobody knows which one is the source of truth.


Written by someone on the RealSec team. Want to talk specifics ; get in touch.

← All notes