Reputation: 13527
This would work if "read" was anything else except for "read":
Schema::table('messages', function($table)
{
$table->renameColumn('read', 'opened');
});
Note: I am using "doctrine/dbal": "2.4.*" in my composer.json and Laravel 4.2. So the problem is that Laravel complains:
check the manual that corresponds to your MySQL server version for the right syntax to use near 'read opened TINYINT(1) DEFAULT '0' NOT NULL' at line 1 (SQL: ALTER TABLE messages CHANGE read opened TINYINT(1) DEFAULT '0' NOT NULL)
So somehow I need to "escape" the word "read", but I don't know how. Any ideas?
Upvotes: 0
Views: 481
Reputation: 32660
You can use double quotes (""
) like this :
"read"
Or use back tick escaping as follows :
`read`
More information : MySQL Reserved Words
Upvotes: 1