Let’s consider the case where I decide to add an isbn column to the already existing Book table, with Rails:
Book name:string (and implicitly, created_at:date, updated_at:date)
From what I’ve seen, it’s an easy task to undertake provided we are fine with the fact the column to add will come out last. But what if I’d prefer to have it just after name, for instance? Despite being an almost entirely irrelevant matter from a Rails’ point of view, I was curious, nonetheless, as I sometimes peek directly the database with other tools.
Thanks
You can do that with a Rails migration, using the
afteroption:You can also say
:first => trueto insert the new column as the first one.