MySQL – Add a column before or after an existing column using Sequelize migrations

Sequelize provides addColumn method to add column to an existing table. But this will add the column as the last column of your table. While this may not affect the working of your database, you might want to add a column after a particular existing column.

In case of mysql, you can provide before or after in the options object being passed to the addColumn. For example, the following code in a migration will add a column called new_col after my_existing_col in the table called awesome.

type: Sequelize.STRING,
allowNull: false,
after: "my_existing_col"

PS: Make sure you check this with other dialects before changing your database type. This may or may not work with other databases depending upon support for before or after options.

Run T-Rex Run!

Google’s latest chrome browsers (canary builds) feel your pain when you are offline. To make things better, they have added an endless running game at the network connection error page.

When you can’t connect to internet, the normal page comes up with message “unable to connect to internet”. But here is the magic. Press Space bar and see the T-rex come to life. It runs through an infinite desert path where you need to avoid the cacti coming in the way. You can press space to make this cute dinasour jump.

The game will record your stats for that particular session and it will be lost if browser is closed or refreshed. Here is a video of me playing the game. Want to share your high score? Post it in the comments 🙂