Answers for "how to run migration file in sql"

SQL
0

migrations.RunSQL

def set_pg_sequence(apps, schema_editor):
    if connection.vendor == "postgresql":
        # Reset sequence of user so Postgres doesn't crash on an existing user
        # ID 100 for our uploader user.
        # http://stackoverflow.com/a/3698777/85461
        migrations.RunSQL(
            """
            SELECT pg_catalog.setval(
                pg_get_serial_sequence('auth_user', 'id'), MAX(id)
            ) FROM auth_user;
            """.format(table_name=settings.AUTH_USER_MODEL)
        )
Posted by: Guest on August-25-2021

Code answers related to "how to run migration file in sql"

Code answers related to "SQL"

Browse Popular Code Answers by Language