|
@ -64,9 +64,12 @@ def migrate_model(model, to_delete, count_limit=None): |
|
|
|
|
|
|
|
|
def reset_seq(id): |
|
|
def reset_seq(id): |
|
|
# resets id sequence |
|
|
# resets id sequence |
|
|
|
|
|
if id > reset_seq.last_id + 1: |
|
|
sql_reset_seq = 'ALTER SEQUENCE %s_id_seq RESTART WITH %s;' % (model._meta.db_table, id) |
|
|
sql_reset_seq = 'ALTER SEQUENCE %s_id_seq RESTART WITH %s;' % (model._meta.db_table, id) |
|
|
cursor = connection.cursor() |
|
|
cursor = connection.cursor() |
|
|
cursor.execute(sql_reset_seq) |
|
|
cursor.execute(sql_reset_seq) |
|
|
|
|
|
reset_seq.last_id = id |
|
|
|
|
|
reset_seq.last_id = -1 |
|
|
|
|
|
|
|
|
legacy_model = legacy_app.get_model(model.__name__) |
|
|
legacy_model = legacy_app.get_model(model.__name__) |
|
|
old_pk_name = legacy_model._meta.pk.name |
|
|
old_pk_name = legacy_model._meta.pk.name |
|
|