1 """Add anonymous column for block documents
2
3 Revision ID: 2d900af9cd07
4 Revises: 84892301571a
5 Create Date: 2022-06-13 10:39:43.872563
6
7 """
8
9 import sqlalchemy as sa 1 ctx 1a
10 from alembic import op 1 ctx 1a
11
12 # revision identifiers, used by Alembic.
13 revision = "2d900af9cd07" 1 ctx 1a
14 down_revision = "84892301571a" 1 ctx 1a
15 branch_labels = None 1 ctx 1a
16 depends_on = None 1 ctx 1a
17
18
19 def upgrade ( ) : 1 ctx 1a
20 # ### commands auto generated by Alembic - please adjust! ###
21 with op . batch_alter_table ( "block_document" , schema = None ) as batch_op : 1 ctx 1a
22 batch_op . add_column ( 1 ctx 1a
23 sa . Column ( "is_anonymous" , sa . Boolean ( ) , server_default = "0" , nullable = False )
24 )
25 batch_op . create_index ( 1 ctx 1a
26 batch_op . f ( "ix_block_document__is_anonymous" ) ,
27 [ "is_anonymous" ] ,
28 unique = False ,
29 )
30
31 # ### end Alembic commands ###
32
33
34 def downgrade ( ) : 1 ctx 1a
35 # ### commands auto generated by Alembic - please adjust! ###
36 with op . batch_alter_table ( "block_document" , schema = None ) as batch_op :
37 batch_op . drop_index ( batch_op . f ( "ix_block_document__is_anonymous" ) )
38 batch_op . drop_column ( "is_anonymous" )
39 # ### end Alembic commands ###