69fb10c3d6f0_files_on_disk.py 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. """files on disk.
  2. Revision ID: 69fb10c3d6f0
  3. Revises: c1cea4bbae16
  4. Create Date: 2017-06-07 17:25:47.306472
  5. """
  6. from alembic import op
  7. from depot.fields.sqlalchemy import UploadedFileField
  8. import sqlalchemy as sa
  9. # revision identifiers, used by Alembic.
  10. revision = '69fb10c3d6f0'
  11. down_revision = 'c1cea4bbae16'
  12. # INFO - A.P - 2017-07-20 - alembic batch migrations
  13. # http://alembic.zzzcomputing.com/en/latest/batch.html
  14. # This migration uses alembic batch mode, a workaround allowing to enforce
  15. # ALTER statement with SQLite while maintaining the traditional behavior of
  16. # the commented lines on other RDBMS.
  17. def upgrade():
  18. """Adds the depot file in revision."""
  19. # op.add_column('content_revisions',
  20. # sa.Column('depot_file',
  21. # UploadedFileField))
  22. with op.batch_alter_table('content_revisions') as batch_op:
  23. batch_op.add_column(sa.Column('depot_file', UploadedFileField))
  24. def downgrade():
  25. """Drops the depot file in revision."""
  26. # op.drop_column('content_revisions', 'depot_file')
  27. with op.batch_alter_table('content_revisions') as batch_op:
  28. batch_op.drop_column('depot_file')