renumber-migrations: Fix construction of new number.

This commit is contained in:
Tim Abbott
2017-08-27 11:59:35 -07:00
parent 96dcb8f745
commit 1560646144

View File

@@ -35,7 +35,8 @@ def renumber_migration(conflicts, order, last_correct_migration):
print(re.sub(r'[\d]+(_[a-z0-9]+)+', last_correct_migration, line), end='')
# Rename the migration indexing at the end
new_name = conflicts[i-1].replace(conflicts[i-1][0:4], '00' + str(int(last_correct_migration[0:4]) + 1))
new_name = conflicts[i-1].replace(conflicts[i-1][0:4],
'%04d' % (int(last_correct_migration[0:4]) + 1,))
os.rename('zerver/migrations/' + conflicts[i-1], 'zerver/migrations/' + new_name)
last_correct_migration = new_name.replace('.py', '')