2

While converting our monolith service to Django micro-services, we are migrating to Postgres a table of users from our old DB.

The users table have a primary 'user_id' field.

At first phase of our migration, we will write new users to both DB's, and will have to insert the users with explicit 'user_id' (from old DB) to the new Postgres DB.

At a later phase we will stop writing to the old DB, and would like to use the auto increment ability.

I know we can reset the sequence to the current MAX(user_id), the thing is we will have a time window where we'll still get explicit inserts from our old Monolith Service, and we don't want the reset to be coupled with the Monolith change.

We're looking for a Django solution to support insertion of both explicit and new generated 'user_id's, by updating the sequence on explicit insertion as well, in atomic way.

Postgres seems to not support it out-of-the-box: https://code.djangoproject.com/ticket/11423

Any ideas?

adibi
  • 41
  • 3
  • Please [edit] your question to show [what you have tried so far](http://whathaveyoutried.com). You should include at least an outline (but preferably a [mcve]) of the code that you are having problems with, then we can try to help with the specific problem. You should also read [ask]. – Toby Speight Mar 29 '17 at 12:02

0 Answers0