#! /bin/bash

read -p "Server [localhost] : " SERVER
SERVER=${SERVER:-localhost}

read -p "Veritabanı : $1" DB
DB=${DB:-$1}

read -p "Yeniden oluşturulsun mu? (E/H) [H] : " CREATE
CREATE=${CREATE:-H}

CREATESTR=""
DROPSTR=""
if [[ ${CREATE} =~ (E|e) ]]; then
    CREATESTR="-create"
    read -p "Eski mevcutsa silinsin mi? (E/H) [E] : " DROP
    DROP=${DROP:-E}
    if [[ ${DROP} =~ (E|e) ]]; then
        DROPSTR="-drop-if-exists"
    fi
fi

migrater -folder ./base -db ${DB} -host ${SERVER}  ${CREATESTR} ${DROPSTR} -password tayitkan -tracker base -migrate-table symigrate
# migrater -folder ./seed -db ${DB} -host ${SERVER}  ${CREATESTR} ${DROPSTR} -password tayitkan -tracker seed -migrate-table symigrate
