
- Baza
- Migratsiya
- Backend
- Ta'lim
Adding a new course without touching the old data
22
Today I added a Python backend course to the platform. The course itself was not the big job — most of the time went into changing the database.
The problem is that the database already holds users and their progress. The new course needed several new fields, and any change carries the risk of damaging data that already exists.
There were two paths. The first: rebuild the tables and migrate the data. That comes out clean, but if I make a mistake in one place, results are lost. The second: add only. Do not touch the old fields, add new ones, and allow them to stay empty.
I chose the second one. It is not particularly elegant — some records in the database now have unfilled fields. But the important part is this: the old data was left completely untouched. Even if the migration failed, there was nothing to lose.
To verify it, I first ran it against a copy of the database. It worked on the copy, then I ran it on the real one. Skipping that step is very tempting, but I skipped it once before and did not enjoy the result.
The course was added and existing users noticed nothing. The best migration is the one nobody notices.