Bash Script: Knex Database Refresh

Jimmy McBride - Jan 5 '20 - - Dev Community

Ever get tired of running the same knex commands every time you need to reset your database? Why not just make a bash script that will run them all in one command?

It's super simple and easy

#!/bin/bash

knex migrate:rollback
knex migrate:latest
knex seed:run
Enter fullscreen mode Exit fullscreen mode

I named mine dbrefresh so now anytime I need my database to be reset all I need to do is type dbrefresh inside my terminal and it will rollback, magrate latest and run my seeds in one sweet and easy command.

Thank you very much for reading! Do you have any bash scripts that you use everyday? I've love to see them in the comments below!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player