<filename>server/migrations/versions/1ba6bdb9ef28_.py
"""empty message

Revision ID: 1ba6bdb9ef28
Revises: <PASSWORD>
Create Date: 2019-10-21 16:30:58.954765

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '1ba6bdb9ef28'
down_revision = 'a<PASSWORD>'
branch_labels = None
depends_on = None


def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###


def downgrade_():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###


def upgrade_user_db():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('calendar_event',
    sa.Column('time_created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.Column('time_updated', sa.DateTime(timezone=True), nullable=True),
    sa.Column('event_id', sa.String(length=500), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('updated_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('organizer_email', sa.String(length=200), nullable=True),
    sa.Column('creator_email', sa.String(length=200), nullable=True),
    sa.Column('status', sa.String(length=200), nullable=True),
    sa.Column('is_recurring', sa.BOOLEAN(), nullable=True),
    sa.Column('recurrence_id', sa.String(length=200), nullable=True),
    sa.Column('title', sa.String(length=500), nullable=True),
    sa.Column('location', sa.String(length=500), nullable=True),
    sa.Column('start_time', sa.TIMESTAMP(), nullable=True),
    sa.Column('end_time', sa.TIMESTAMP(), nullable=True),
    sa.Column('description', sa.String(length=5000), nullable=True),
    sa.PrimaryKeyConstraint('event_id')
    )
    op.create_table('calendar_event_attendee',
    sa.Column('time_created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.Column('time_updated', sa.DateTime(timezone=True), nullable=True),
    sa.Column('event_id', sa.String(length=500), nullable=False),
    sa.Column('invited_email', sa.String(length=200), nullable=False),
    sa.Column('timezone', sa.String(length=200), nullable=True),
    sa.Column('calendar_user_id', sa.String(length=100), nullable=True),
    sa.Column('working_hours_start_time', sa.TIME(), nullable=True),
    sa.Column('working_hours_end_time', sa.TIME(), nullable=True),
    sa.Column('timezone_organized', sa.String(length=200), nullable=True),
    sa.Column('display_name', sa.String(length=200), nullable=True),
    sa.Column('response_status', sa.String(length=20), nullable=True),
    sa.Column('is_organizer', sa.BOOLEAN(), nullable=True),
    sa.Column('is_optional', sa.BOOLEAN(), nullable=True),
    sa.Column('comment', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['calendar_user_id'], ['calendar_user.id'], ),
    sa.ForeignKeyConstraint(['event_id'], ['calendar_event.event_id'], ),
    sa.PrimaryKeyConstraint('event_id', 'invited_email')
    )
    op.drop_table('calendar_event_attendees')
    op.drop_table('calendar_events')
    # ### end Alembic commands ###


def downgrade_user_db():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('calendar_events',
    sa.Column('time_created', mysql.DATETIME(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True),
    sa.Column('time_updated', mysql.DATETIME(), nullable=True),
    sa.Column('id', mysql.VARCHAR(length=500), nullable=False),
    sa.Column('calendar_id', mysql.VARCHAR(length=150), nullable=True),
    sa.Column('created_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('organizer_email', mysql.VARCHAR(length=200), nullable=True),
    sa.Column('is_recurring', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('title', mysql.VARCHAR(length=500), nullable=True),
    sa.Column('location', mysql.VARCHAR(length=500), nullable=True),
    sa.Column('start_time', mysql.TIMESTAMP(), nullable=True),
    sa.Column('end_time', mysql.TIMESTAMP(), nullable=True),
    sa.Column('description', mysql.VARCHAR(length=5000), nullable=True),
    sa.Column('creator_email', mysql.VARCHAR(length=200), nullable=True),
    sa.Column('status', mysql.VARCHAR(length=200), nullable=True),
    sa.CheckConstraint('(`is_recurring` in (0,1))', name='calendar_events_chk_1'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_table('calendar_event_attendees',
    sa.Column('time_created', mysql.DATETIME(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True),
    sa.Column('time_updated', mysql.DATETIME(), nullable=True),
    sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
    sa.Column('event_id', mysql.VARCHAR(length=500), nullable=True),
    sa.Column('working_hours_start_time', mysql.TIME(), nullable=True),
    sa.Column('working_hours_end_time', mysql.TIME(), nullable=True),
    sa.Column('display_name', mysql.VARCHAR(length=200), nullable=True),
    sa.Column('response_status', mysql.VARCHAR(length=20), nullable=True),
    sa.Column('is_organizer', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('is_optional', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('calendar_user_id', mysql.VARCHAR(length=100), nullable=True),
    sa.Column('comment', mysql.VARCHAR(length=5000), nullable=True),
    sa.Column('invited_email', mysql.VARCHAR(length=200), nullable=True),
    sa.Column('timezone_organized', mysql.VARCHAR(length=200), nullable=True),
    sa.CheckConstraint('(`is_optional` in (0,1))', name='calendar_event_attendees_chk_2'),
    sa.CheckConstraint('(`is_organizer` in (0,1))', name='calendar_event_attendees_chk_1'),
    sa.ForeignKeyConstraint(['calendar_user_id'], ['calendar_user.id'], name='calendar_event_attendees_ibfk_2'),
    sa.ForeignKeyConstraint(['event_id'], ['calendar_events.id'], name='calendar_event_attendees_ibfk_1'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.drop_table('calendar_event_attendee')
    op.drop_table('calendar_event')
    # ### end Alembic commands ###


<filename>server/migrations/versions/1ba6bdb9ef28_.py
"""empty message

Revision ID: 1ba6bdb9ef28
Revises: <PASSWORD>
Create Date: 2019-10-21 16:30:58.954765

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '1ba6bdb9ef28'
down_revision = 'a<PASSWORD>'
branch_labels = None
depends_on = None


def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###


def downgrade_():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###


def upgrade_user_db():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('calendar_event',
    sa.Column('time_created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.Column('time_updated', sa.DateTime(timezone=True), nullable=True),
    sa.Column('event_id', sa.String(length=500), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('updated_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('organizer_email', sa.String(length=200), nullable=True),
    sa.Column('creator_email', sa.String(length=200), nullable=True),
    sa.Column('status', sa.String(length=200), nullable=True),
    sa.Column('is_recurring', sa.BOOLEAN(), nullable=True),
    sa.Column('recurrence_id', sa.String(length=200), nullable=True),
    sa.Column('title', sa.String(length=500), nullable=True),
    sa.Column('location', sa.String(length=500), nullable=True),
    sa.Column('start_time', sa.TIMESTAMP(), nullable=True),
    sa.Column('end_time', sa.TIMESTAMP(), nullable=True),
    sa.Column('description', sa.String(length=5000), nullable=True),
    sa.PrimaryKeyConstraint('event_id')
    )
    op.create_table('calendar_event_attendee',
    sa.Column('time_created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.Column('time_updated', sa.DateTime(timezone=True), nullable=True),
    sa.Column('event_id', sa.String(length=500), nullable=False),
    sa.Column('invited_email', sa.String(length=200), nullable=False),
    sa.Column('timezone', sa.String(length=200), nullable=True),
    sa.Column('calendar_user_id', sa.String(length=100), nullable=True),
    sa.Column('working_hours_start_time', sa.TIME(), nullable=True),
    sa.Column('working_hours_end_time', sa.TIME(), nullable=True),
    sa.Column('timezone_organized', sa.String(length=200), nullable=True),
    sa.Column('display_name', sa.String(length=200), nullable=True),
    sa.Column('response_status', sa.String(length=20), nullable=True),
    sa.Column('is_organizer', sa.BOOLEAN(), nullable=True),
    sa.Column('is_optional', sa.BOOLEAN(), nullable=True),
    sa.Column('comment', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['calendar_user_id'], ['calendar_user.id'], ),
    sa.ForeignKeyConstraint(['event_id'], ['calendar_event.event_id'], ),
    sa.PrimaryKeyConstraint('event_id', 'invited_email')
    )
    op.drop_table('calendar_event_attendees')
    op.drop_table('calendar_events')
    # ### end Alembic commands ###


def downgrade_user_db():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('calendar_events',
    sa.Column('time_created', mysql.DATETIME(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True),
    sa.Column('time_updated', mysql.DATETIME(), nullable=True),
    sa.Column('id', mysql.VARCHAR(length=500), nullable=False),
    sa.Column('calendar_id', mysql.VARCHAR(length=150), nullable=True),
    sa.Column('created_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('organizer_email', mysql.VARCHAR(length=200), nullable=True),
    sa.Column('is_recurring', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('title', mysql.VARCHAR(length=500), nullable=True),
    sa.Column('location', mysql.VARCHAR(length=500), nullable=True),
    sa.Column('start_time', mysql.TIMESTAMP(), nullable=True),
    sa.Column('end_time', mysql.TIMESTAMP(), nullable=True),
    sa.Column('description', mysql.VARCHAR(length=5000), nullable=True),
    sa.Column('creator_email', mysql.VARCHAR(length=200), nullable=True),
    sa.Column('status', mysql.VARCHAR(length=200), nullable=True),
    sa.CheckConstraint('(`is_recurring` in (0,1))', name='calendar_events_chk_1'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_table('calendar_event_attendees',
    sa.Column('time_created', mysql.DATETIME(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True),
    sa.Column('time_updated', mysql.DATETIME(), nullable=True),
    sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
    sa.Column('event_id', mysql.VARCHAR(length=500), nullable=True),
    sa.Column('working_hours_start_time', mysql.TIME(), nullable=True),
    sa.Column('working_hours_end_time', mysql.TIME(), nullable=True),
    sa.Column('display_name', mysql.VARCHAR(length=200), nullable=True),
    sa.Column('response_status', mysql.VARCHAR(length=20), nullable=True),
    sa.Column('is_organizer', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('is_optional', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('calendar_user_id', mysql.VARCHAR(length=100), nullable=True),
    sa.Column('comment', mysql.VARCHAR(length=5000), nullable=True),
    sa.Column('invited_email', mysql.VARCHAR(length=200), nullable=True),
    sa.Column('timezone_organized', mysql.VARCHAR(length=200), nullable=True),
    sa.CheckConstraint('(`is_optional` in (0,1))', name='calendar_event_attendees_chk_2'),
    sa.CheckConstraint('(`is_organizer` in (0,1))', name='calendar_event_attendees_chk_1'),
    sa.ForeignKeyConstraint(['calendar_user_id'], ['calendar_user.id'], name='calendar_event_attendees_ibfk_2'),
    sa.ForeignKeyConstraint(['event_id'], ['calendar_events.id'], name='calendar_event_attendees_ibfk_1'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.drop_table('calendar_event_attendee')
    op.drop_table('calendar_event')
    # ### end Alembic commands ###


empty message  Revision ID: 1ba6bdb9ef28 Revises: <PASSWORD> Create Date: 2019-10-21 16:30:58.954765 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###