from alembic import op
import sqlalchemy as sa


revision = '0209_email_branding_update'
down_revision = '84c3b6eb16b3'


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('email_branding', sa.Column('text', sa.String(length=255), nullable=True))
    op.execute('UPDATE email_branding SET text = name')
    op.execute('UPDATE email_branding SET name = NULL')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('email_branding', 'text')
    # ### end Alembic commands ###

from alembic import op
import sqlalchemy as sa


revision = '0209_email_branding_update'
down_revision = '84c3b6eb16b3'


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('email_branding', sa.Column('text', sa.String(length=255), nullable=True))
    op.execute('UPDATE email_branding SET text = name')
    op.execute('UPDATE email_branding SET name = NULL')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute('UPDATE email_branding SET name = text')
    op.drop_column('email_branding', 'text')
    # ### end Alembic commands ###

Move data back before dropping the column for downgrade
Move data back before dropping the column for downgrade

  from alembic import op
  import sqlalchemy as sa
  
  
  revision = '0209_email_branding_update'
  down_revision = '84c3b6eb16b3'
  
  
  def upgrade():
      # ### commands auto generated by Alembic - please adjust! ###
      op.add_column('email_branding', sa.Column('text', sa.String(length=255), nullable=True))
      op.execute('UPDATE email_branding SET text = name')
      op.execute('UPDATE email_branding SET name = NULL')
      # ### end Alembic commands ###
  
  
  def downgrade():
      # ### commands auto generated by Alembic - please adjust! ###
+     op.execute('UPDATE email_branding SET name = text')
      op.drop_column('email_branding', 'text')
      # ### end Alembic commands ###
  
Move data back before dropping the column for downgrade
## Code Before:
from alembic import op
import sqlalchemy as sa


revision = '0209_email_branding_update'
down_revision = '84c3b6eb16b3'


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('email_branding', sa.Column('text', sa.String(length=255), nullable=True))
    op.execute('UPDATE email_branding SET text = name')
    op.execute('UPDATE email_branding SET name = NULL')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('email_branding', 'text')
    # ### end Alembic commands ###

## Instruction:
Move data back before dropping the column for downgrade
## Code After:
from alembic import op
import sqlalchemy as sa


revision = '0209_email_branding_update'
down_revision = '84c3b6eb16b3'


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('email_branding', sa.Column('text', sa.String(length=255), nullable=True))
    op.execute('UPDATE email_branding SET text = name')
    op.execute('UPDATE email_branding SET name = NULL')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute('UPDATE email_branding SET name = text')
    op.drop_column('email_branding', 'text')
    # ### end Alembic commands ###
