"""org default template

Revision: 0070
Revision ID: 8a9754acb4a
Revises: 423db8281cbe
Create Date: 2016-08-11 16:35:33.251306

"""

# revision identifiers, used by Alembic.
revision = '8a9754acb4a'
down_revision = '423db8281cbe'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

def upgrade():
    op.add_column('organizations', sa.Column('default_template_id', sa.Integer(), nullable=True))
    op.create_foreign_key('organizations_default_template_id', 'organizations', 'projects', ['default_template_id'], ['id'], ondelete='SET NULL')


def downgrade():
    op.drop_constraint('organizations_default_template_id', 'organizations', type_='foreignkey')
    op.drop_column('organizations', 'default_template_id')
