diff options
| author | Andrew Dickinson <Andrew-Dickinson@users.noreply.github.com> | 2020-04-20 09:30:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-20 15:30:27 +0200 |
| commit | 026a0722357d74b143ed2d974ad2d871a56041b3 (patch) | |
| tree | 2f23323f01e5ec1dec07ef1032acc407cba38879 /ihatemoney/migrations/versions/cb038f79982e_sqlite_autoincrement.py | |
| parent | 91ef80ebb712b06b6c48336beeb7f60219b0f062 (diff) | |
| download | ihatemoney-mirror-026a0722357d74b143ed2d974ad2d871a56041b3.zip ihatemoney-mirror-026a0722357d74b143ed2d974ad2d871a56041b3.tar.gz ihatemoney-mirror-026a0722357d74b143ed2d974ad2d871a56041b3.tar.bz2 | |
Add Project History Page (#553)
Co-Authored-By: Glandos <bugs-github@antipoul.fr>
All project activity can be tracked, using SQLAlchemy-continuum.
IP addresses can optionally be recorded.
Diffstat (limited to 'ihatemoney/migrations/versions/cb038f79982e_sqlite_autoincrement.py')
| -rw-r--r-- | ihatemoney/migrations/versions/cb038f79982e_sqlite_autoincrement.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ihatemoney/migrations/versions/cb038f79982e_sqlite_autoincrement.py b/ihatemoney/migrations/versions/cb038f79982e_sqlite_autoincrement.py new file mode 100644 index 0000000..ae5ab32 --- /dev/null +++ b/ihatemoney/migrations/versions/cb038f79982e_sqlite_autoincrement.py @@ -0,0 +1,50 @@ +"""sqlite_autoincrement + +Revision ID: cb038f79982e +Revises: 2dcb0c0048dc +Create Date: 2020-04-13 17:40:02.426957 + +""" + +# revision identifiers, used by Alembic. +revision = "cb038f79982e" +down_revision = "2dcb0c0048dc" + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + alter_table_batches = [ + op.batch_alter_table( + "person", recreate="always", table_kwargs={"sqlite_autoincrement": True} + ), + op.batch_alter_table( + "bill", recreate="always", table_kwargs={"sqlite_autoincrement": True} + ), + op.batch_alter_table( + "billowers", recreate="always", table_kwargs={"sqlite_autoincrement": True} + ), + ] + + for batch_op in alter_table_batches: + with batch_op: + pass + + +def downgrade(): + alter_table_batches = [ + op.batch_alter_table( + "person", recreate="always", table_kwargs={"sqlite_autoincrement": False} + ), + op.batch_alter_table( + "bill", recreate="always", table_kwargs={"sqlite_autoincrement": False} + ), + op.batch_alter_table( + "billowers", recreate="always", table_kwargs={"sqlite_autoincrement": False} + ), + ] + + for batch_op in alter_table_batches: + with batch_op: + pass |
