Skip to content

composite primary key #6

@schmunk42

Description

@schmunk42

When the primary key is composed of two columns, the command generation is also incorrect:

CREATE TABLE IF NOT EXISTS `alert_listener` (
  `alert_listener_id` int(11) NOT NULL AUTO_INCREMENT,
  `listener` varchar(250) DEFAULT NULL COMMENT 'Describes the listner (email address, phone number, ...).',
  `listener_type` int(11) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT NULL,
  `entity_alert_id` int(11) NOT NULL,
  PRIMARY KEY (`alert_listener_id`,`entity_alert_id`),
  KEY `fk_alert_listener_device_alert1` (`entity_alert_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=815 ;

gives

$this->createTable(AlertListener::model()->tableName(),
                array(
                        "alert_listener_id"=>"pk",
                        "listener"=>"varchar(250)",
                        "listener_type"=>"int(11)",
                        "is_active"=>"tinyint(1)",
                        "entity_alert_id"=>"int(11) NOT NULL",
                        "PRIMARY KEY (entity_alert_id)"
                ),
                $options);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions