-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy path1a55b7674144_form_history.py
53 lines (45 loc) · 2.34 KB
/
1a55b7674144_form_history.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""Form history
Revision ID: 1a55b7674144
Revises: e664a2f70952
Create Date: 2023-01-02 09:41:58.716218
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1a55b7674144'
down_revision = 'e664a2f70952'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('form_history',
sa.Column('created', sa.DateTime(), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('form_id', sa.String(), nullable=False),
sa.Column('parent_form_id', sa.String(), nullable=False),
sa.Column('created_by', sa.String(), nullable=False),
sa.Column('change_log', sa.JSON(), nullable=False),
sa.Column('workflow', sa.Boolean(), nullable=True),
sa.Column('title', sa.Boolean(), nullable=True),
sa.Column('component_change', sa.Boolean(), nullable=True),
sa.Column('anonymous', sa.Boolean(), nullable=True),
sa.Column('status', sa.Boolean(), nullable=True),
sa.Column('form_type', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_form_history_form_id'), 'form_history', ['form_id'], unique=False)
op.add_column('form_process_mapper', sa.Column('form_type', sa.String(length=20), nullable=True))
op.execute("update form_process_mapper set form_type = 'form' where form_process_mapper.form_type is null or form_process_mapper.form_type = ''")
op.alter_column('form_process_mapper', 'form_type', nullable=False)
op.add_column('form_process_mapper', sa.Column('parent_form_id', sa.String(length=50), nullable=True))
op.execute("update form_process_mapper set parent_form_id = form_process_mapper.form_id where form_process_mapper.parent_form_id is null or form_process_mapper.parent_form_id = ''")
op.alter_column('form_process_mapper', 'parent_form_id', nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('form_process_mapper', 'parent_form_id')
op.drop_column('form_process_mapper', 'form_type')
op.drop_index(op.f('ix_form_history_parent_form_id'), table_name='form_history')
op.drop_index(op.f('ix_form_history_form_id'), table_name='form_history')
op.drop_table('form_history')
# ### end Alembic commands ###