rails/rails — pull request #13247 by yahonda (2013-12-10 02:21:47+00:00)
Title: Remove `DEFAULT NULL` for primary key column to support MySQL 5.7.3

This pull request addresses ActiveRecord unit tests error with MySQL 5.7.3_m13.

```ruby
Mysql::Error: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead: CREATE TABLE `accounts` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `firm_id` int(11), `firm_name` varchar(255), `credit_limit` int(11)) ENGINE=InnoDB (ActiveRecord::StatementInvalid)
```

It would probably because of this [fix](http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-3.html)

```quote
Columns in a PRIMARY KEY must be NOT NULL, but if declared explicitly as NULL produced no error. Now an error occurs. For example, a statement such as CREATE TABLE t (i INT NULL PRIMARY KEY) is rejected. The same occurs for similar ALTER TABLE statements. (Bug #13995622, Bug #66987, Bug #15967545, Bug #16545198)
```

Also I was trying to find the reason why primary column can be `DEFAULT NULL` but it is set from the beginning.
https://github.com/rails/rails/commit/eac7cf0b0608132673220d9045b8ff51dc0804e1

```ruby
:primary_key => "int(11) DEFAULT NULL auto_increment PRIMARY KEY",
```