Last active
September 13, 2016 09:39
-
-
Save sgeos/1fed5eb24d80b97a338249dd95d55082 to your computer and use it in GitHub Desktop.
exrm PostgreSQL/MySQL release equivalents for `mix ecto.create` and `mix ecto.drop`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PostgreSQL `mix ecto.create` equivalent | |
psql -c "CREATE USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}';" | |
createdb "${DB_NAME}" | |
psql -c "GRANT ALL PRIVILEGES ON DATABASE ${DB_NAME} to ${DB_USER};" | |
# PostgreSQL `mix ecto.drop` equivalent | |
dropdb "${DB_NAME}" | |
dropuser "${DB_USER}" | |
# PostgresSQL interactive terminal | |
PGPASSWORD="${DB_PASSWORD}" psql -U "${DB_USER}" "${DB_NAME}" | |
# MySQL `mix ecto.create` equivalent | |
mysql -e "CREATE USER '${DB_USER}'@'localhost' IDENTIFIED BY '${DB_PASSWORD}';" | |
mysql -e "CREATE DATABASE ${DB_NAME};" | |
mysql -e "GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO '${DB_USER}'@'localhost' IDENTIFIED BY '${DB_PASSWORD}';" | |
mysql -e "FLUSH PRIVILEGES;" | |
# MySQL `mix ecto.drop` equivalent | |
mysql -e "DROP DATABASE ${DB_NAME};" | |
mysql -e "DROP USER '${DB_USER}'@'localhost';" | |
# MySQL interactive terminal | |
mysql -u"${DB_USER}" -p"${DB_PASSWORD}" "${DB_NAME}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment