"""empty message

Revision ID: 4563894e92cd
Revises: 
Create Date: 2021-01-26 14:50:50.767882

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '4563894e92cd'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('buku',
    sa.Column('nomor_buku', sa.BigInteger(), autoincrement=False, nullable=False),
    sa.Column('judul', sa.String(length=200), nullable=False),
    sa.Column('pengarang', sa.String(length=100), nullable=False),
    sa.Column('tahun_terbit', sa.Integer(), nullable=False),
    sa.Column('penerbit', sa.String(length=200), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('update_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('nomor_buku')
    )
    op.create_table('fakultas',
    sa.Column('id_fakultas', sa.Integer(), autoincrement=False, nullable=False),
    sa.Column('nama_fakultas', sa.String(length=250), nullable=False),
    sa.PrimaryKeyConstraint('id_fakultas')
    )
    op.create_table('level',
    sa.Column('id_level', sa.Integer(), autoincrement=False, nullable=False),
    sa.Column('keterangan', sa.String(length=200), nullable=False),
    sa.PrimaryKeyConstraint('id_level')
    )
    op.create_table('prodi',
    sa.Column('id_prodi', sa.Integer(), autoincrement=False, nullable=False),
    sa.Column('nama_prodi', sa.String(length=250), nullable=False),
    sa.PrimaryKeyConstraint('id_prodi')
    )
    op.create_table('mahasiswa',
    sa.Column('npm', sa.BigInteger(), autoincrement=False, nullable=False),
    sa.Column('nama', sa.String(length=200), nullable=False),
    sa.Column('no_hp', sa.BigInteger(), nullable=False),
    sa.Column('angkatan', sa.Integer(), nullable=False),
    sa.Column('alamat', sa.String(length=200), nullable=False),
    sa.Column('prodi', sa.Integer(), nullable=True),
    sa.Column('fakultas', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['fakultas'], ['fakultas.id_fakultas'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['prodi'], ['prodi.id_prodi'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('npm')
    )
    op.create_table('user',
    sa.Column('id_user', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('npm', sa.BigInteger(), nullable=True),
    sa.Column('nama', sa.String(length=100), nullable=False),
    sa.Column('email', sa.String(length=60), nullable=False),
    sa.Column('password', sa.String(length=250), nullable=False),
    sa.Column('level', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['level'], ['level.id_level'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['npm'], ['mahasiswa.npm'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id_user')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('user')
    op.drop_table('mahasiswa')
    op.drop_table('prodi')
    op.drop_table('level')
    op.drop_table('fakultas')
    op.drop_table('buku')
    # ### end Alembic commands ###
