portal-oddajanje-solar/migrations/versions/0cf2d8f74766_altered_cooperation_history_structure.py

37 lines
1.1 KiB
Python

"""Altered cooperation history structure.
Revision ID: 0cf2d8f74766
Revises: c7bb822adf9f
Create Date: 2022-02-14 13:04:01.143637
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0cf2d8f74766'
down_revision = 'c7bb822adf9f'
branch_labels = None
depends_on = None
def upgrade():
# Delete all rows
query = 'DELETE FROM user_cooperation;'
op.execute(query)
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user_cooperation', sa.Column('timestamp', sa.DateTime(), nullable=False))
op.drop_column('user_cooperation', 'badge_text')
op.drop_column('user_cooperation', 'school_year')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user_cooperation', sa.Column('school_year', sa.VARCHAR(), autoincrement=False, nullable=False))
op.add_column('user_cooperation', sa.Column('badge_text', sa.VARCHAR(), autoincrement=False, nullable=True))
op.drop_column('user_cooperation', 'timestamp')
# ### end Alembic commands ###