Scripts: Add script for resetting postgres sequences for imports.

This commit is contained in:
Rhea Parekh
2017-12-01 17:27:28 +05:30
committed by showell
parent ef2f27980a
commit 460e9b4634
2 changed files with 9 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
#!/bin/bash
set -e
./manage.py sqlsequencereset zerver | ./manage.py dbshell
echo "Sequence has been reset successfully!"

View File

@@ -72,3 +72,7 @@ import a database dump from one or more JSON files."""
print("Processing dump: %s ..." % (path,))
do_import_realm(path)
if options["destroy_rebuild_database"]:
print("Resetting auto-increment sequence for Postgres......")
subprocess.check_call([os.path.join(settings.DEPLOY_ROOT,
"scripts/setup/postgres-reset-sequences")])