A
A
Alexander2016-05-10 08:58:54
Django
Alexander, 2016-05-10 08:58:54

How to secure data when changing the database architecture?

For example, there was a news table with fields: id, alias, title, description . After that, I decided to install multilanguage and installed django-parler. I started the migration of the news table , the fields became: id, alias and a new news_translation table was created with the fields: id, language_code, title, description, master_id .
In general, all the data that was in news disappeared after the migration.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2016-05-10
@kentuck1213

If wisely, you should first perform a migration that creates an additional table, then create and perform data migration , and then perform a migration that removes fields from the original table. Or execute the dumpdata command , perform the migration, and then throw in a simple script that will fill the new table with previously saved data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question