getSchema() as $tableName => $table ) { foreach ( $table->fields as $fieldName => $field ) { if ( $field->autoIncrement === true ) { $found = false; // Loop over de indexes to see if there is a primary foreach ( $table->indexes as $indexName => $index ) { if ( $index->primary === true ) { $found = true; break; } } if ( !$found ) { $errors[] = "Field '$tableName:$fieldName' is auto increment but there is no primary index defined."; } } } } return $errors; } } ?>