Blob Blame Raw
"""
Add organisation logos and branding CSS.

Revision ID: 5948e1b95495
Revises: c576636d1bfe
Create Date: 2017-06-06 18:03:49.197275

"""

# revision identifiers, used by Alembic.
revision = '5948e1b95495'
down_revision = 'c576636d1bfe'

from alembic import op
import sqlalchemy as sa


def upgrade():
    op.create_table('organisation_branding',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('enabled', sa.Boolean(),
                              server_default=sa.text('false'), nullable=False),
                    sa.Column('organisation_id', sa.Integer(), nullable=False),
                    sa.Column('logo_id', sa.Integer(), nullable=True),
                    sa.Column('theme', sa.String(), nullable=True),
                    sa.Column('custom_css_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(['custom_css_id'],
                                            ['documentfile.id'], ),
                    sa.ForeignKeyConstraint(['logo_id'],
                                            ['documentfile.id'], ),
                    sa.ForeignKeyConstraint(['organisation_id'],
                                            ['organisation.id'], ),
                    sa.PrimaryKeyConstraint('id'))


def downgrade():
    op.drop_table('organisation_branding')