Maybe you’ve run into this, too? You’re taking a look at the tables generated by your Rails migration and you see this really odd column.
Here’s another look:
Searching the web didn’t turn up much in this case, so I thought I’d post what I found when figuring out the root cause.
See the issue in this migration?
No? I didn’t the first time I looked, either.
It’s the comma – at the tail end of the last column definition before t.timestamps.
This little typo doesn’t look like much, but it’s the cause of that wacky column.
Here’s what the table looks like when you run the migration with the comma:
And here’s what it looks like when you fix your typo:
Ah! Much better.
As for creating a migration to fix this, I just resolved the typo and dropped the column manually. It’s a little difficult to script this because the column name will be different in each database, so, it’s some variation of this (the part in bold on each database that the original typo ran on):
ALTER TABLE `friendships` DROP `#<ActiveRecord::ConnectionAdapters::TableDefinition:0x10245fd78>`;
Hope this helps someone else avoid wasting time on this!