"""Init

Revision ID: 4feb484b3fd4
Revises: None
Create Date: 2014-06-20 21:57:46.271797

"""

# revision identifiers, used by Alembic.
revision = '4feb484b3fd4'
down_revision = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('inboxes',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('userMail', sa.String(length=255), nullable=True),
    sa.Column('account', sa.String(length=255), nullable=True),
    sa.Column('password', sa.String(length=255), nullable=True),
    sa.Column('firstName', sa.String(length=255), nullable=True),
    sa.Column('lastName', sa.String(length=255), nullable=True),
    sa.Column('imapServer', sa.String(length=255), nullable=True),
    sa.Column('smtpServer', sa.String(length=255), nullable=True),
    sa.Column('imapPort', sa.String(length=255), nullable=True),
    sa.Column('smtpPort', sa.String(length=255), nullable=True),
    sa.Column('imapSSL', sa.Integer(), nullable=True),
    sa.Column('smtpSSL', sa.Integer(), nullable=True),
    sa.Column('smtpAuth', sa.Integer(), nullable=True),
    sa.Column('nbr_mails', sa.Integer(), nullable=True),
    sa.Column('nbr_addresses', sa.Integer(), nullable=True),
    sa.Column('colourblind_mode', sa.Integer(), nullable=True),
    sa.Column('font_size', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('ix_inboxes_password', 'inboxes', ['password'], unique=False)
    op.create_table('contacts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=255), nullable=True),
    sa.Column('emailAddress', sa.String(length=255), nullable=True),
    sa.Column('picture', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('ix_contacts_name', 'contacts', ['name'], unique=False)
    op.create_table('mails',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('remoteID', sa.String(length=255),nullable=True),
    sa.Column('date', sa.String(length=255), nullable=True),
    sa.Column('subject', sa.String(length=255), nullable=True),
    sa.Column('_from', sa.String(length=255), nullable=True),
    sa.Column('to', sa.String(length=255), nullable=True),
    sa.Column('cc', sa.Text(), nullable=True),
    sa.Column('bcc', sa.Text(), nullable=True),
    sa.Column('inReplyTo', sa.String(length=255), nullable=True),
    sa.Column('message', sa.String(length=255), nullable=True),
    sa.Column('inboxId', sa.Integer(), nullable=True),
    sa.Column('read', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['inboxId'], ['inboxes.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('ix_mails_inReplyTo', 'mails', ['inReplyTo'], unique=False)
    op.create_index('ix_mails_message', 'mails', ['message'], unique=False)
    op.create_index('ix_mails_subject', 'mails', ['subject'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_mails_subject', 'mails')
    op.drop_index('ix_mails_message', 'mails')
    op.drop_index('ix_mails_inReplyTo', 'mails')
    op.drop_table('mails')
    op.drop_index('ix_contacts_lastName', 'contacts')
    op.drop_table('contacts')
    op.drop_index('ix_inboxes_password', 'inboxes')
    op.drop_table('inboxes')
    ### end Alembic commands ###
