1def set_pg_sequence(apps, schema_editor):
2 if connection.vendor == "postgresql":
3 # Reset sequence of user so Postgres doesn't crash on an existing user
4 # ID 100 for our uploader user.
5 # http://stackoverflow.com/a/3698777/85461
6 migrations.RunSQL(
7 """
8 SELECT pg_catalog.setval(
9 pg_get_serial_sequence('auth_user', 'id'), MAX(id)
10 ) FROM auth_user;
11 """.format(table_name=settings.AUTH_USER_MODEL)
12 )
13