
# revision identifiers, used by Alembic.
revision = '49c670c7d705'
down_revision = 'a3afeab3302'

from alembic import op
import sqlalchemy as sa


def upgrade():
  op.add_column(
      'programs',
      sa.Column('private', sa.Boolean(), default=False, nullable=False),
      )

def downgrade():
  op.drop_column('programs', 'private')


# revision identifiers, used by Alembic.
revision = '49c670c7d705'
down_revision = 'a3afeab3302'

from alembic import op
from sqlalchemy.sql import table, column
import sqlalchemy as sa

def upgrade():
  op.add_column(
      'programs',
      sa.Column('private', sa.Boolean(), default=False, nullable=False),
      )
  programs_table = table('programs',
      column('id', sa.Integer),
      column('context_id', sa.Integer),
      column('private', sa.Boolean),
      )
  op.execute(programs_table.update().values(private=True)\
      .where(programs_table.c.context_id != None))
  
def downgrade():
  op.drop_column('programs', 'private')

Make sure to properly set private for existing private programs.
Make sure to properly set private for existing private programs.

  
  # revision identifiers, used by Alembic.
  revision = '49c670c7d705'
  down_revision = 'a3afeab3302'
  
  from alembic import op
+ from sqlalchemy.sql import table, column
  import sqlalchemy as sa
- 
  
  def upgrade():
    op.add_column(
        'programs',
        sa.Column('private', sa.Boolean(), default=False, nullable=False),
        )
- 
+   programs_table = table('programs',
+       column('id', sa.Integer),
+       column('context_id', sa.Integer),
+       column('private', sa.Boolean),
+       )
+   op.execute(programs_table.update().values(private=True)\
+       .where(programs_table.c.context_id != None))
+   
  def downgrade():
    op.drop_column('programs', 'private')
  
Make sure to properly set private for existing private programs.
## Code Before:

# revision identifiers, used by Alembic.
revision = '49c670c7d705'
down_revision = 'a3afeab3302'

from alembic import op
import sqlalchemy as sa


def upgrade():
  op.add_column(
      'programs',
      sa.Column('private', sa.Boolean(), default=False, nullable=False),
      )

def downgrade():
  op.drop_column('programs', 'private')

## Instruction:
Make sure to properly set private for existing private programs.
## Code After:

# revision identifiers, used by Alembic.
revision = '49c670c7d705'
down_revision = 'a3afeab3302'

from alembic import op
from sqlalchemy.sql import table, column
import sqlalchemy as sa

def upgrade():
  op.add_column(
      'programs',
      sa.Column('private', sa.Boolean(), default=False, nullable=False),
      )
  programs_table = table('programs',
      column('id', sa.Integer),
      column('context_id', sa.Integer),
      column('private', sa.Boolean),
      )
  op.execute(programs_table.update().values(private=True)\
      .where(programs_table.c.context_id != None))
  
def downgrade():
  op.drop_column('programs', 'private')
