0

I have been working on a Django app for a client. throughout development there have been data migrations (data insertions/modifications, not structural changes) that have been specific to the client. I am now working on bringing on other clients to use the same app, so I want all reminents of the client specific data removed from the migration files. I feel like the safe and simple way is to keep those migration files and just erase the data migration operations logic. I dont see any reason to keep the data migration logic around anyways, even for the initial client, as it has already been tested and applied in their production environment a while ago. My question: Is this solution sound or are there other points that should be considered?

I've searched on the matter, but have not found anything relating to a situation like mine where the data migrations will be introduced to a context where they are incorrect.

5
  • 1
    Database migrations history work in tandem with the state of the database. If you are bringing the new clients to use the same database in the current state then there’s nothing much you can do about the migrations history. But if you are bringing the new clients in to use a fresh database with the same source code, then simply deleting the migrations history of the cloned repo and setting the source to use the fresh database is quite simple. The answer to your question lies in what database (old or new) the new clients will be using. As for moving from dev to production, the same applies. Commented Aug 12, 2024 at 19:13
  • 1
    See previous comment. In summary: working with an old database will often and or always require having the migrations history of the database both those on the file system and those in the database. But working with a fresh database can allow getting rid of migrations history. Commented Aug 12, 2024 at 19:17
  • @ChukwujiobiCanon the new clients will have a new database, the initial client will will maintain the current database. I would like all copies of the app to have identical source code, including the migration files. I understand that the full migration history will be applied to the new clients DB, which is why i thought to keep the irrelevent migration files, but remove from them the db logic of inserting data that shouldnt be inserted. Commented Aug 14, 2024 at 8:13
  • What is the rationale behind having identical source scripts with identical migration history when they aren’t using the same database? Commented Aug 14, 2024 at 11:48
  • @ChukwujiobiCanon I want the databases to have the same structure (same tables, columns, constraints, etc). The migration scripts serve 2 main purposes - altering the structure and altering the actual data. The current structure of the database is derived from the sum of the structural changes defined in the migration scripts, so I would like those to be identical. The reason for having different databases is providing clients with a physical seperation of data (and also scaleability at some point). Commented Aug 14, 2024 at 15:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.