How would I write this differently to make it compatible with MYSQL 5.7 There is an issue with using unique =&gt; true in defining an attribute as a primary key when using MYSQL 5.7.*. 

protected function defineAttributes()
{
    return array(
        'eid' =&gt; array(AttributeType::Number, 'unique' =&gt; true, 'column' =&gt; ColumnType::PK) 
    );
}


According to my setting this error should not occur. Here is the error. 

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1171 All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead


Here is the SQL executed.

system.db.CDbCommand.execute(CREATE TABLE `craft_venti_events` (
    `eid` int(11) NOT NULL AUTO_INCREMENT NULL,
    `eventid` INT(10) NULL,
    `startDate` datetime NULL,
    `endDate` datetime NULL,
    `allDay` INT(10) NULL,
    `repeat` INT(10) NULL,
    `rRule` VARCHAR(255) NULL,
    `summary` VARCHAR(255) NULL,
    `isrepeat` INT(10) NULL,
    `locale` VARCHAR(255) NULL,
    `dateCreated` datetime NOT NULL,
    `dateUpdated` datetime NOT NULL,
    `uid` CHAR(36) NOT NULL DEFAULT 0,
    PRIMARY KEY (eid)
) ENGINE=InnoDb DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci)
Turns out this is a bug as of Craft 2.6.2931 with the ColumnType::PK enum 
in a record's attribute type definition.

Pretty sure it'd be a bug in &lt; MySQL 5.7 because it's invalid SQL syntax as well unless they're just more forgiving of it there.

This is a non-issue in the upcoming Craft 3 release (the concept of attributes no longer exists and plugins explicitly define their table schema create statements), but the workaround for Craft 2 until the bug is fixed is to not use a record here and manually create the table schema that you need by adding an onBeforeInstall method to your plugin.