Skip to content

Autodetect SQL UNIQUE KEY and generate isUnique() #182

@ionas

Description

@ionas

At least for me unique constraint detection did not work. Should it?

CREATE TABLE `manage_manufacturers` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `vc24_manufacturer_id` bigint(20) NOT NULL,
  `is_visible` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `vc24_manufacturer_id` (`vc24_manufacturer_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

Expected in buildRules():

$rules->add($rules->isUnique(['vc24_manufacturer_id']));

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions