<filename>crisismgmt-api/migrations/versions/3973ca8938e8_.py
"""empty message

Revision ID: 3973ca8938e8
Revises: 
Create Date: 2021-04-24 16:34:27.580574

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('chat_rooms',
    sa.Column('chatroom_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('chatroom_name', sa.String(length=500), nullable=False),
    sa.PrimaryKeyConstraint('chatroom_id')
    )
    op.create_table('help_doc',
    sa.Column('help_doc_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('content_url', sa.String(length=500), nullable=False),
    sa.Column('event_type', sa.String(length=191), nullable=False),
    sa.PrimaryKeyConstraint('help_doc_id')
    )
    op.create_table('resource',
    sa.Column('resource_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('resource_name', sa.String(length=500), nullable=False),
    sa.Column('resource_multiplier', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('resource_id')
    )
    op.create_table('users',
    sa.Column('user_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('is_authority', sa.Integer(), nullable=True),
    sa.Column('first_name', sa.String(length=191), nullable=False),
    sa.Column('last_name', sa.String(length=191), nullable=False),
    sa.Column('email', sa.String(length=120), nullable=False),
    sa.Column('password', sa.String(length=255), nullable=False),
    sa.Column('status', sa.String(length=255), nullable=False),
    sa.Column('location', sa.String(length=255), nullable=False),
    sa.Column('created_date', sa.DateTime(), nullable=True),
    sa.Column('updated_date', sa.DateTime(), nullable=True),
    sa.Column('contact_number', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('user_id'),
    sa.UniqueConstraint('email')
    )
    op.create_table('chat_messages',
    sa.Column('message_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('chatroom_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('message', sa.String(length=500), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['chatroom_id'], ['chat_rooms.chatroom_id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('message_id')
    )
    op.create_table('chat_participants',
    sa.Column('participant_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('chat_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['chat_id'], ['chat_rooms.chatroom_id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('participant_id')
    )
    op.create_table('contact_list',
    sa.Column('contact_list_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('contact_user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['contact_user_id'], ['users.user_id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('contact_list_id')
    )
    op.create_table('event',
    sa.Column('event_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('event_name', sa.String(length=500), nullable=False),
    sa.Column('severity', sa.String(length=191), nullable=False),
    sa.Column('event_type', sa.String(length=191), nullable=False),
    sa.Column('location', sa.String(length=191), nullable=False),
    sa.Column('is_active', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('event_id')
    )
    op.create_table('node',
    sa.Column('node_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('node_name', sa.String(length=500), nullable=False),
    sa.Column('node_location', sa.String(length=500), nullable=False),
    sa.Column('max_capacity', sa.Integer(), nullable=False),
    sa.Column('current_capacity', sa.Integer(), nullable=False),
    sa.Column('event_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['event_id'], ['event.event_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('node_id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('node')
    op.drop_table('event')
    op.drop_table('contact_list')
    op.drop_table('chat_participants')
    op.drop_table('chat_messages')
    op.drop_table('users')
    op.drop_table('resource')
    op.drop_table('help_doc')
    op.drop_table('chat_rooms')
    # ### end Alembic commands ###

<filename>crisismgmt-api/migrations/versions/3973ca8938e8_.py
"""empty message

Revision ID: 3973ca8938e8
Revises: 
Create Date: 2021-04-24 16:34:27.580574

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('chat_rooms',
    sa.Column('chatroom_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('chatroom_name', sa.String(length=500), nullable=False),
    sa.PrimaryKeyConstraint('chatroom_id')
    )
    op.create_table('help_doc',
    sa.Column('help_doc_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('content_url', sa.String(length=500), nullable=False),
    sa.Column('event_type', sa.String(length=191), nullable=False),
    sa.PrimaryKeyConstraint('help_doc_id')
    )
    op.create_table('resource',
    sa.Column('resource_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('resource_name', sa.String(length=500), nullable=False),
    sa.Column('resource_multiplier', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('resource_id')
    )
    op.create_table('users',
    sa.Column('user_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('is_authority', sa.Integer(), nullable=True),
    sa.Column('first_name', sa.String(length=191), nullable=False),
    sa.Column('last_name', sa.String(length=191), nullable=False),
    sa.Column('email', sa.String(length=120), nullable=False),
    sa.Column('password', sa.String(length=255), nullable=False),
    sa.Column('status', sa.String(length=255), nullable=False),
    sa.Column('location', sa.String(length=255), nullable=False),
    sa.Column('created_date', sa.DateTime(), nullable=True),
    sa.Column('updated_date', sa.DateTime(), nullable=True),
    sa.Column('contact_number', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('user_id'),
    sa.UniqueConstraint('email')
    )
    op.create_table('chat_messages',
    sa.Column('message_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('chatroom_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('message', sa.String(length=500), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['chatroom_id'], ['chat_rooms.chatroom_id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('message_id')
    )
    op.create_table('chat_participants',
    sa.Column('participant_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('chat_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['chat_id'], ['chat_rooms.chatroom_id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('participant_id')
    )
    op.create_table('contact_list',
    sa.Column('contact_list_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('contact_user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['contact_user_id'], ['users.user_id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('contact_list_id')
    )
    op.create_table('event',
    sa.Column('event_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('event_name', sa.String(length=500), nullable=False),
    sa.Column('severity', sa.String(length=191), nullable=False),
    sa.Column('event_type', sa.String(length=191), nullable=False),
    sa.Column('location', sa.String(length=191), nullable=False),
    sa.Column('is_active', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('event_id')
    )
    op.create_table('node',
    sa.Column('node_id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('node_name', sa.String(length=500), nullable=False),
    sa.Column('node_location', sa.String(length=500), nullable=False),
    sa.Column('max_capacity', sa.Integer(), nullable=False),
    sa.Column('current_capacity', sa.Integer(), nullable=False),
    sa.Column('event_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['event_id'], ['event.event_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('node_id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('node')
    op.drop_table('event')
    op.drop_table('contact_list')
    op.drop_table('chat_participants')
    op.drop_table('chat_messages')
    op.drop_table('users')
    op.drop_table('resource')
    op.drop_table('help_doc')
    op.drop_table('chat_rooms')
    # ### end Alembic commands ###

empty message  Revision ID: 3973ca8938e8 Revises:  Create Date: 2021-04-24 16:34:27.580574 # 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 ###