Skip to content

rake db:migrate でエラー #25

@yamato1992

Description

@yamato1992

rake db:migrateによるMysql2のエラー

Installation for Developerの手順に従い、インストールを行った際に発生

原因

使用しているMySQLのバージョンが5.7.3以上の場合に発生するようである。
エラー内容 :

Mysql2::Error: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead: CREATE TABLE `tags` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `name` varchar(255), `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB

対応方法

MySQLのバージョンを5.5に下げることで対応した。
また、これ単体に関してはrailのバージョンを上げることでも対応可能である。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions