lino.management.commands.resetsequences

resetsequences

Reset the database sequences for all plugins.

This is required (and automatically called) on a postgres after restoring from a snapshot (restore.py) because this operation specifies explicit primary keys.

Unlike Django's sqlsequencereset command this does not just output the SQL statements, it also executes them. And it works always on all plugins so you don't need to specify their names.

This is functionally equivalent to the following:

python manage.py sqlsequencereset APP1 APP2... | python manage.py shell

On SQLite or MySQL this command does nothing.

In PostgreSQL, Sequence objects are special single-row tables created with CREATE SEQUENCE. Sequence objects are commonly used to generate unique identifiers for rows of a table (exceprt from PostgreSQL docs).

See 2017-09-07, 2017-09-30.

(This module's source code is available here.)

Classes

Command([stdout, stderr, no_color, force_color])